|
1 |
| -println("Times for 8 argument example using all macros") |
| 1 | +println("Times for 11 argument example using all macros") |
2 | 2 | println("Load Time (using ArgMacros)")
|
3 | 3 | @time using ArgMacros
|
4 | 4 | using Test
|
5 | 5 |
|
6 | 6 | # Commands Set 1
|
7 | 7 | let
|
8 | 8 | empty!(ARGS)
|
9 |
| - append!(ARGS, ["TEST STRING F", "-deeee", "30", "3.14", "-b=6.28", "--cc", "ArgMacros", "-a", "2"]) |
| 9 | + append!(ARGS, ["TEST STRING F", "-deeee", "30", "3.14", "-b=6.28", "--cc", "ArgMacros", "-a", "2", "4", "5", "6"]) |
10 | 10 |
|
11 | 11 | println("Inline Arguments Time with Precompile")
|
12 | 12 | let
|
|
22 | 22 | @positionaldefault Int 20 g
|
23 | 23 | @argtest g (x -> x % 10 == 0)
|
24 | 24 | @positionaloptional Float64 h
|
| 25 | + @positionalleftover Int64 i |
25 | 26 | end
|
26 | 27 | end
|
27 | 28 |
|
|
38 | 39 | @positionaldefault Int 20 g
|
39 | 40 | @argtest g (x -> x % 10 == 0)
|
40 | 41 | @positionaloptional Float64 h
|
| 42 | + @positionalleftover Int64 i |
41 | 43 | end
|
42 | 44 |
|
43 | 45 | println("Struct Arguments Time")
|
|
54 | 56 | @positionaldefault Int 20 g
|
55 | 57 | @argtest g (x -> x % 10 == 0)
|
56 | 58 | @positionaloptional Float64 h
|
| 59 | + @positionalleftover Int64 i |
57 | 60 | end
|
58 | 61 |
|
59 | 62 | argsstruct = ArgsStruct()
|
|
72 | 75 | @positionaldefault Int 20 g
|
73 | 76 | @argtest g (x -> x % 10 == 0)
|
74 | 77 | @positionaloptional Float64 h
|
| 78 | + @positionalleftover Int64 i |
75 | 79 | end
|
76 | 80 |
|
77 | 81 | println("Dict Arguments Time")
|
|
87 | 91 | @positionaldefault Int 20 g
|
88 | 92 | @argtest g (x -> x % 10 == 0)
|
89 | 93 | @positionaloptional Float64 h
|
| 94 | + @positionalleftover Int64 i |
90 | 95 | end
|
91 | 96 |
|
92 | 97 | @testset "Correct, All Arguments" begin
|
|
98 | 103 | @test e == 4
|
99 | 104 | @test f == "TEST STRING F"
|
100 | 105 | @test g == 30
|
101 |
| - @test h == 3.14 |
| 106 | + @test h == 3.14 |
| 107 | + @test i == [4, 5, 6] |
102 | 108 | end
|
103 | 109 |
|
104 | 110 | @testset "Struct" begin
|
|
109 | 115 | @test argsstruct.e == 4
|
110 | 116 | @test argsstruct.f == "TEST STRING F"
|
111 | 117 | @test argsstruct.g == 30
|
112 |
| - @test argsstruct.h == 3.14 |
| 118 | + @test argsstruct.h == 3.14 |
| 119 | + @test argsstruct.i == [4, 5, 6] |
113 | 120 | end
|
114 | 121 |
|
115 | 122 | @testset "Tuple" begin
|
|
120 | 127 | @test argstuple.e == 4
|
121 | 128 | @test argstuple.f == "TEST STRING F"
|
122 | 129 | @test argstuple.g == 30
|
123 |
| - @test argstuple.h == 3.14 |
| 130 | + @test argstuple.h == 3.14 |
| 131 | + @test argstuple.i == [4, 5, 6] |
124 | 132 | end
|
125 | 133 |
|
126 | 134 | @testset "Dict" begin
|
|
131 | 139 | @test argsdict[:e] == 4
|
132 | 140 | @test argsdict[:f] == "TEST STRING F"
|
133 | 141 | @test argsdict[:g] == 30
|
134 |
| - @test argsdict[:h] == 3.14 |
| 142 | + @test argsdict[:h] == 3.14 |
| 143 | + @test argsdict[:i] == [4, 5, 6] |
135 | 144 | end
|
136 | 145 | end
|
137 | 146 | end
|
|
153 | 162 | @positionaldefault Int 20 g
|
154 | 163 | @argtest g (x -> x % 10 == 0)
|
155 | 164 | @positionaloptional Float64 h
|
| 165 | + @positionalleftover Int64 i |
156 | 166 | end
|
157 | 167 |
|
158 | 168 | @structarguments false ArgsStruct begin
|
|
167 | 177 | @positionaldefault Int 20 g
|
168 | 178 | @argtest g (x -> x % 10 == 0)
|
169 | 179 | @positionaloptional Float64 h
|
| 180 | + @positionalleftover Int64 i |
170 | 181 | end
|
171 | 182 |
|
172 | 183 | argsstruct = ArgsStruct()
|
|
183 | 194 | @positionaldefault Int 20 g
|
184 | 195 | @argtest g (x -> x % 10 == 0)
|
185 | 196 | @positionaloptional Float64 h
|
| 197 | + @positionalleftover Int64 i |
186 | 198 | end
|
187 | 199 |
|
188 | 200 | argsdict = @dictarguments begin
|
|
197 | 209 | @positionaldefault Int 20 g
|
198 | 210 | @argtest g (x -> x % 10 == 0)
|
199 | 211 | @positionaloptional Float64 h
|
| 212 | + @positionalleftover Int64 i |
200 | 213 | end
|
201 | 214 |
|
202 | 215 | @testset "Correct, Minimal Arguments" begin
|
|
209 | 222 | @test f == "OTHER TEST STRING F"
|
210 | 223 | @test g == 20
|
211 | 224 | @test isnothing(h)
|
| 225 | + @test isempty(i) |
212 | 226 | end
|
213 | 227 |
|
214 | 228 | @testset "Struct" begin
|
|
220 | 234 | @test argsstruct.f == "OTHER TEST STRING F"
|
221 | 235 | @test argsstruct.g == 20
|
222 | 236 | @test isnothing(argsstruct.h)
|
| 237 | + @test isempty(argsstruct.i) |
223 | 238 | end
|
224 | 239 |
|
225 | 240 | @testset "Tuple" begin
|
|
231 | 246 | @test argstuple.f == "OTHER TEST STRING F"
|
232 | 247 | @test argstuple.g == 20
|
233 | 248 | @test isnothing(argstuple.h)
|
| 249 | + @test isempty(argstuple.i) |
234 | 250 | end
|
235 | 251 |
|
236 | 252 | @testset "Dict" begin
|
|
242 | 258 | @test argsdict[:f] == "OTHER TEST STRING F"
|
243 | 259 | @test argsdict[:g] == 20
|
244 | 260 | @test isnothing(argsdict[:h])
|
| 261 | + @test isempty(argsdict[:i]) |
245 | 262 | end
|
246 | 263 | end
|
247 | 264 | end
|
|
0 commit comments