-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidator-mac-tests.red
More file actions
64 lines (57 loc) · 1.49 KB
/
validator-mac-tests.red
File metadata and controls
64 lines (57 loc) · 1.49 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
Red [
Title: "MAC validator tests"
Description: "Testing functionality of MAC validator using RedUnit framework"
Author: "Mateusz Palichleb"
File: %validator-mac-tests.red
]
context [
setup: func [
"Initialize/Reload context before each test"
] [
do %../src/validator.red
]
/local valid-mac-addresses: [
"01:23:45:67:89:ab"
"00:25:96:12:34:56"
"01:23:45:67:89:AB"
"01-23-45-67-89-ab"
"01-23-45-67-89-AB"
"00:0A:E6:3E:FD:E1"
"00-15-E9-2B-99-3C"
"00:09:3D:12:33:33"
"0123.4567.89ab"
"0123.4567.89AB"
]
/local invalid-mac-addresses: [
"01:23:45:67:89:aB"
"01.23:45:67:89:ab"
"GH:23:45:67:89:AB"
"01-23-45-67-89"
"01.23:45-67:89:FF"
"01-23AB-67-89-AB"
"0123.456789ab"
"0123456789AB"
]
test-valid-mac: func [
"Testing only valid MAC addresses"
] [
foreach mac valid-mac-addresses [
; for debugging
;if (false == valid/mac mac) [
; print rejoin [ "Failure: " mac ]
;]
tester/assert-true valid/mac mac
]
]
test-invalid-mac: func [
"Testing incorrect MAC addresses"
] [
foreach mac invalid-mac-addresses [
; for debugging
;if (true == valid/mac mac) [
; print rejoin [ "Failure: " mac ]
;]
tester/assert-false valid/mac mac
]
]
]