-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmulti_option_test.v
More file actions
61 lines (56 loc) · 1.35 KB
/
multi_option_test.v
File metadata and controls
61 lines (56 loc) · 1.35 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
import os
import rand
struct RunConfig {
shape string
size int = 5
symbol string = '*'
output []string
}
const all_options_test_cases = [
RunConfig{
shape: 'square'
size: 5
symbol: '|'
output: ['|||||', '|||||', '|||||', '|||||', '|||||']
},
RunConfig{
shape: 'pyramid'
size: 3
symbol: '^'
output: [' ^', ' ^^^', '^^^^^']
},
RunConfig{
shape: 'diamond'
size: 4
symbol: '*'
output: [' *', ' ***', ' *****', '*******', ' *****', ' ***', ' *']
},
]
const shape_only_test_cases = [
RunConfig{
shape: 'square'
output: ['*****', '*****', '*****', '*****', '*****']
},
RunConfig{
shape: 'pyramid'
output: [' *', ' ***', ' *****', ' *******', '*********']
},
RunConfig{
shape: 'left-triangle'
output: ['*', '**', '***', '****', '*****']
},
]
fn test_all() {
// Test all options
for case in all_options_test_cases {
result := os.execute_or_panic('${os.quoted_path(@VEXE)} -o ${rand.ulid()} run . --shape ${case.shape} --size ${case.size} --symbol "${case.symbol}"')
assert result.exit_code == 0
assert result.output.split_into_lines() == case.output
}
// Test shapes only
for case in shape_only_test_cases {
result := os.execute_or_panic('${os.quoted_path(@VEXE)} -o ${rand.ulid()} run . --shape ${case.shape}')
assert result.exit_code == 0
assert result.output.split_into_lines() == case.output
}
}