1
+ @ echo off
2
+ setlocal enableextensions enabledelayedexpansion
3
+ rem Copyright (C) 2022 Muhammad Athallah
4
+
5
+ rem This free document is distributed in the hope that it will be
6
+ rem useful, but WITHOUT ANY WARRANTY; without even the implied
7
+ rem warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8
+
9
+ rem REV09 Tue 12 Apr 2022 14:03:32 WIB
10
+ rem START Tue 12 Apr 2022 13:47:15 WIB
11
+
12
+ echo Pastikan file uji kasus berada di folder tc pada parent directory bersama dengan folder kode mahasiswa dan skrip ini.
13
+
14
+ set /p ASDOSCODE = Masukkan kode asisten dosen kamu:
15
+ set /p MAINCLASS = Masukkan nama file main class:
16
+
17
+ rem Count testcase file
18
+ set /a TESTCASEAMTRAW = 0
19
+ for /r tc %%X in (*.txt) do set /a TESTCASEAMTRAW += 1
20
+ set /a TESTCASEAMT = ! TESTCASEAMTRAW! / 2
21
+
22
+ rem Get current directory
23
+ set PWD = %cd%
24
+
25
+ rem For loop each student's directory
26
+ for /d %%i in (%PWD% \%ASDOSCODE% *\) do (
27
+ echo Grading %%i ...
28
+ cd " %%i "
29
+
30
+ echo Compiling files...
31
+ javac *.java
32
+
33
+ rem Make folder
34
+ if not exist " out\" mkdir out
35
+ if not exist " report\" mkdir report
36
+
37
+ for /l %%j in (1, 1, %TESTCASEAMT% ) do (
38
+ echo Checking test case #%%j ...
39
+ type ..\tc\in%%j .txt | java %MAINCLASS% > out\out%%j .txt
40
+ fc /w out\out%%j .txt ..\tc\out%%j .txt
41
+ fc /w out\out%%j .txt ..\tc\out%%j .txt > report\testcase$i.txt
42
+ )
43
+
44
+ echo Done grading %%i .
45
+ echo .
46
+
47
+ cd ..
48
+ )
49
+ echo Press any key to continue . . .
50
+ pause
51
+ echo .
0 commit comments