feat: integration-test (#13)
添加集成测试,当前只有公开测试集的70个样例。 Reviewed-on: PostGuard/Canon#13
This commit is contained in:
		
							
								
								
									
										28
									
								
								.gitea/workflows/integration_test.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.gitea/workflows/integration_test.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
name: Integration Test
 | 
			
		||||
on:
 | 
			
		||||
    push:
 | 
			
		||||
        branches:
 | 
			
		||||
            - master
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
    Open-Set-Test:
 | 
			
		||||
        runs-on: archlinux
 | 
			
		||||
        steps:
 | 
			
		||||
            -   name: Check out repository code
 | 
			
		||||
                uses: https://git.rrricardo.top/actions/checkout@v4
 | 
			
		||||
            -   name: Use nuget package cache
 | 
			
		||||
                uses: https://git.rrricardo.top/actions/cache@v4
 | 
			
		||||
                with:
 | 
			
		||||
                    path: ~/.nuget/packages
 | 
			
		||||
                    key: ${{ runner.os }}-nuget
 | 
			
		||||
                    save-always: true
 | 
			
		||||
            -   name: Build binary file
 | 
			
		||||
                run: |
 | 
			
		||||
                    dotnet publish
 | 
			
		||||
                    cp ./Canon.Console/bin/Release/net8.0/linux-x64/publish/Canon.Console ./pacss
 | 
			
		||||
            -   name: Build open set binary
 | 
			
		||||
                run: |
 | 
			
		||||
                    python scripts/integration_test.py run
 | 
			
		||||
            -   name: Run open set test
 | 
			
		||||
                run: |
 | 
			
		||||
                    python scripts/integration_test.py test
 | 
			
		||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -485,7 +485,3 @@ $RECYCLE.BIN/
 | 
			
		||||
 | 
			
		||||
# Database Source File
 | 
			
		||||
*.db
 | 
			
		||||
 | 
			
		||||
# Integration Generated File
 | 
			
		||||
open_set/**
 | 
			
		||||
!*.pas
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,7 @@ EndProject
 | 
			
		||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{EAA3629C-CD74-4E1F-A7F8-76D1FF0EC925}"
 | 
			
		||||
	ProjectSection(SolutionItems) = preProject
 | 
			
		||||
		.gitea\workflows\test.yaml = .gitea\workflows\test.yaml
 | 
			
		||||
		.gitea\workflows\integration_test.yaml = .gitea\workflows\integration_test.yaml
 | 
			
		||||
	EndProjectSection
 | 
			
		||||
EndProject
 | 
			
		||||
Global
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								open_set/26_op_priority4.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								open_set/26_op_priority4.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
0 1 1 1 1
 | 
			
		||||
							
								
								
									
										1
									
								
								open_set/30_logi_assign.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								open_set/30_logi_assign.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
4 4
 | 
			
		||||
							
								
								
									
										4
									
								
								open_set/34_short_circuit.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								open_set/34_short_circuit.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
11
 | 
			
		||||
10
 | 
			
		||||
100
 | 
			
		||||
99
 | 
			
		||||
							
								
								
									
										10
									
								
								open_set/40_percolation.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								open_set/40_percolation.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
2 2
 | 
			
		||||
3 1
 | 
			
		||||
4 2
 | 
			
		||||
4 4
 | 
			
		||||
1 2
 | 
			
		||||
2 3
 | 
			
		||||
2 1
 | 
			
		||||
3 2
 | 
			
		||||
3 4
 | 
			
		||||
3 1
 | 
			
		||||
							
								
								
									
										2
									
								
								open_set/42_color.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								open_set/42_color.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
5
 | 
			
		||||
2 2 2 2 2
 | 
			
		||||
							
								
								
									
										200
									
								
								open_set/44_reverse_output.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								open_set/44_reverse_output.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,200 @@
 | 
			
		||||
0
 | 
			
		||||
3
 | 
			
		||||
6
 | 
			
		||||
9
 | 
			
		||||
12
 | 
			
		||||
15
 | 
			
		||||
18
 | 
			
		||||
21
 | 
			
		||||
24
 | 
			
		||||
27
 | 
			
		||||
30
 | 
			
		||||
33
 | 
			
		||||
36
 | 
			
		||||
39
 | 
			
		||||
42
 | 
			
		||||
45
 | 
			
		||||
48
 | 
			
		||||
51
 | 
			
		||||
54
 | 
			
		||||
57
 | 
			
		||||
60
 | 
			
		||||
63
 | 
			
		||||
66
 | 
			
		||||
69
 | 
			
		||||
72
 | 
			
		||||
75
 | 
			
		||||
78
 | 
			
		||||
81
 | 
			
		||||
84
 | 
			
		||||
87
 | 
			
		||||
90
 | 
			
		||||
93
 | 
			
		||||
96
 | 
			
		||||
99
 | 
			
		||||
102
 | 
			
		||||
105
 | 
			
		||||
108
 | 
			
		||||
111
 | 
			
		||||
114
 | 
			
		||||
117
 | 
			
		||||
120
 | 
			
		||||
123
 | 
			
		||||
126
 | 
			
		||||
129
 | 
			
		||||
132
 | 
			
		||||
135
 | 
			
		||||
138
 | 
			
		||||
141
 | 
			
		||||
144
 | 
			
		||||
147
 | 
			
		||||
150
 | 
			
		||||
153
 | 
			
		||||
156
 | 
			
		||||
159
 | 
			
		||||
162
 | 
			
		||||
165
 | 
			
		||||
168
 | 
			
		||||
171
 | 
			
		||||
174
 | 
			
		||||
177
 | 
			
		||||
180
 | 
			
		||||
183
 | 
			
		||||
186
 | 
			
		||||
189
 | 
			
		||||
192
 | 
			
		||||
195
 | 
			
		||||
198
 | 
			
		||||
201
 | 
			
		||||
204
 | 
			
		||||
207
 | 
			
		||||
210
 | 
			
		||||
213
 | 
			
		||||
216
 | 
			
		||||
219
 | 
			
		||||
222
 | 
			
		||||
225
 | 
			
		||||
228
 | 
			
		||||
231
 | 
			
		||||
234
 | 
			
		||||
237
 | 
			
		||||
240
 | 
			
		||||
243
 | 
			
		||||
246
 | 
			
		||||
249
 | 
			
		||||
252
 | 
			
		||||
255
 | 
			
		||||
258
 | 
			
		||||
261
 | 
			
		||||
264
 | 
			
		||||
267
 | 
			
		||||
270
 | 
			
		||||
273
 | 
			
		||||
276
 | 
			
		||||
279
 | 
			
		||||
282
 | 
			
		||||
285
 | 
			
		||||
288
 | 
			
		||||
291
 | 
			
		||||
294
 | 
			
		||||
297
 | 
			
		||||
300
 | 
			
		||||
303
 | 
			
		||||
306
 | 
			
		||||
309
 | 
			
		||||
312
 | 
			
		||||
315
 | 
			
		||||
318
 | 
			
		||||
321
 | 
			
		||||
324
 | 
			
		||||
327
 | 
			
		||||
330
 | 
			
		||||
333
 | 
			
		||||
336
 | 
			
		||||
339
 | 
			
		||||
342
 | 
			
		||||
345
 | 
			
		||||
348
 | 
			
		||||
351
 | 
			
		||||
354
 | 
			
		||||
357
 | 
			
		||||
360
 | 
			
		||||
363
 | 
			
		||||
366
 | 
			
		||||
369
 | 
			
		||||
372
 | 
			
		||||
375
 | 
			
		||||
378
 | 
			
		||||
381
 | 
			
		||||
384
 | 
			
		||||
387
 | 
			
		||||
390
 | 
			
		||||
393
 | 
			
		||||
396
 | 
			
		||||
399
 | 
			
		||||
402
 | 
			
		||||
405
 | 
			
		||||
408
 | 
			
		||||
411
 | 
			
		||||
414
 | 
			
		||||
417
 | 
			
		||||
420
 | 
			
		||||
423
 | 
			
		||||
426
 | 
			
		||||
429
 | 
			
		||||
432
 | 
			
		||||
435
 | 
			
		||||
438
 | 
			
		||||
441
 | 
			
		||||
444
 | 
			
		||||
447
 | 
			
		||||
450
 | 
			
		||||
453
 | 
			
		||||
456
 | 
			
		||||
459
 | 
			
		||||
462
 | 
			
		||||
465
 | 
			
		||||
468
 | 
			
		||||
471
 | 
			
		||||
474
 | 
			
		||||
477
 | 
			
		||||
480
 | 
			
		||||
483
 | 
			
		||||
486
 | 
			
		||||
489
 | 
			
		||||
492
 | 
			
		||||
495
 | 
			
		||||
498
 | 
			
		||||
501
 | 
			
		||||
504
 | 
			
		||||
507
 | 
			
		||||
510
 | 
			
		||||
513
 | 
			
		||||
516
 | 
			
		||||
519
 | 
			
		||||
522
 | 
			
		||||
525
 | 
			
		||||
528
 | 
			
		||||
531
 | 
			
		||||
534
 | 
			
		||||
537
 | 
			
		||||
540
 | 
			
		||||
543
 | 
			
		||||
546
 | 
			
		||||
549
 | 
			
		||||
552
 | 
			
		||||
555
 | 
			
		||||
558
 | 
			
		||||
561
 | 
			
		||||
564
 | 
			
		||||
567
 | 
			
		||||
570
 | 
			
		||||
573
 | 
			
		||||
576
 | 
			
		||||
579
 | 
			
		||||
582
 | 
			
		||||
585
 | 
			
		||||
588
 | 
			
		||||
591
 | 
			
		||||
594
 | 
			
		||||
597
 | 
			
		||||
							
								
								
									
										10
									
								
								open_set/45_dijkstra.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								open_set/45_dijkstra.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
6 9
 | 
			
		||||
1 2 1
 | 
			
		||||
2 3 9
 | 
			
		||||
1 3 12
 | 
			
		||||
2 4 3
 | 
			
		||||
4 3 4
 | 
			
		||||
3 5 5
 | 
			
		||||
4 5 13
 | 
			
		||||
5 6 4
 | 
			
		||||
4 6 15
 | 
			
		||||
							
								
								
									
										37
									
								
								open_set/46_full_conn.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								open_set/46_full_conn.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
6
 | 
			
		||||
 | 
			
		||||
1 2 3 4 5
 | 
			
		||||
5 6 7 8 9
 | 
			
		||||
9 8 7 6 5
 | 
			
		||||
4 3 2 1 1
 | 
			
		||||
1 1 5 9 4
 | 
			
		||||
 | 
			
		||||
1 1 1 1 1
 | 
			
		||||
1 1 1 1 1
 | 
			
		||||
1 1 1 1 1
 | 
			
		||||
1 1 1 1 1
 | 
			
		||||
1 1 1 1 1
 | 
			
		||||
 | 
			
		||||
1 1 1 1 1
 | 
			
		||||
2 2 2 2 2
 | 
			
		||||
3 3 3 3 3
 | 
			
		||||
4 4 4 4 4
 | 
			
		||||
5 5 5 5 5
 | 
			
		||||
 | 
			
		||||
1 2 3 4 5
 | 
			
		||||
1 2 3 4 5
 | 
			
		||||
1 2 3 4 5
 | 
			
		||||
1 2 3 4 5
 | 
			
		||||
1 2 3 4 5
 | 
			
		||||
 | 
			
		||||
5 4 3 2 1
 | 
			
		||||
5 4 3 2 1
 | 
			
		||||
5 4 3 2 1
 | 
			
		||||
5 4 3 2 1
 | 
			
		||||
5 4 3 2 1
 | 
			
		||||
 | 
			
		||||
1 2 3 2 1
 | 
			
		||||
4 5 6 5 4
 | 
			
		||||
7 8 9 8 7
 | 
			
		||||
4 5 6 5 4
 | 
			
		||||
1 2 3 2 1
 | 
			
		||||
							
								
								
									
										5
									
								
								open_set/47_hanoi.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								open_set/47_hanoi.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
4
 | 
			
		||||
4
 | 
			
		||||
7
 | 
			
		||||
3
 | 
			
		||||
9
 | 
			
		||||
							
								
								
									
										2
									
								
								open_set/48_n_queens.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								open_set/48_n_queens.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
4
 | 
			
		||||
1 5 6 8
 | 
			
		||||
@@ -53,6 +53,7 @@ def run_binary():
 | 
			
		||||
    binary_files = compile_files()
 | 
			
		||||
    for pair in binary_files:
 | 
			
		||||
        print("Info: run " + pair[0])
 | 
			
		||||
        print(pair[1])
 | 
			
		||||
 | 
			
		||||
        pascal_result = "open_set/" + pair[0] + ".pas_result"
 | 
			
		||||
        c_result = "open_set/" + pair[0] + ".c_result"
 | 
			
		||||
@@ -99,7 +100,8 @@ def check_result():
 | 
			
		||||
                    print("C: ", c_result)
 | 
			
		||||
 | 
			
		||||
    print(str(pass_result) + "/" + str(len(tests)) + " tests passed!")
 | 
			
		||||
 | 
			
		||||
    if pass_result != len(tests):
 | 
			
		||||
        sys.exit(-1)
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    if sys.argv[1] == "run":
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user