-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathtime_tests.dm
More file actions
75 lines (63 loc) · 2.32 KB
/
time_tests.dm
File metadata and controls
75 lines (63 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/datum/unit_test/time
name = "TIME - Template"
template = /datum/unit_test/time
/datum/unit_test/time/shall_validate_sixth_of_june
name = "Shall validate 6th of June"
/datum/unit_test/time/shall_validate_sixth_of_june/start_test()
var/datum/is_date/day/D = new(6, 6)
if(D.IsValid())
pass("Validation succeeded")
else
fail("Validation failed")
qdel(D)
return TRUE
/datum/unit_test/time/shall_not_validate_not_sixth_of_june
name = "Shall not validate not-6th of June"
/datum/unit_test/time/shall_not_validate_not_sixth_of_june/start_test()
var/datum/is_date/day/D = new(1, 1)
if(D.IsValid())
fail("Unexpected validation")
else
pass("Did not validate")
qdel(D)
return TRUE
/datum/unit_test/time/shall_validate_range_that_include_sixt_of_june_start_before_end
name = "Shall be able to validate range that include 6th of June - Start before End"
/datum/unit_test/time/shall_validate_range_that_include_sixt_of_june_start_before_end/start_test()
var/datum/is_date/range/R = new(5, 5, 7, 7)
if(R.IsValid())
pass("Validation succeeded")
else
fail("Validation failed")
qdel(R)
return TRUE
/datum/unit_test/time/shall_validate_range_that_include_sixt_of_june_start_after_end
name = "Shall be able to validate range that include 6th of June - Start after End"
/datum/unit_test/time/shall_validate_range_that_include_sixt_of_june_start_after_end/start_test()
var/datum/is_date/range/R = new(8, 8, 7, 7)
if(R.IsValid())
pass("Validation succeeded")
else
fail("Validation failed")
qdel(R)
return TRUE
/datum/unit_test/time/shall_not_validate_range_that_exlude_sixt_of_june_start_before_end
name = "Shall not validate range that exlude 6th of June - Start before End"
/datum/unit_test/time/shall_not_validate_range_that_exlude_sixt_of_june_start_before_end/start_test()
var/datum/is_date/range/R = new(7, 7, 8, 8)
if(R.IsValid())
fail("Unexpected validation")
else
pass("Did not validate")
qdel(R)
return TRUE
/datum/unit_test/time/shall_not_validate_range_that_exclude_sixt_of_june_start_after_end
name = "Shall not validate range that exlude 6th of June - Start after End"
/datum/unit_test/time/shall_not_validate_range_that_exclude_sixt_of_june_start_after_end/start_test()
var/datum/is_date/range/R = new(7, 7, 5, 5)
if(R.IsValid())
fail("Unexpected validation")
else
pass("Did not validate")
qdel(R)
return TRUE