You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can test your own code with the [test script](https://github.com/pl3onasm/Imperative-programming/blob/main/ctest.sh). It will try to compile your code and run it on all the test cases. It will also compare your output with the expected output, and check for memory leaks by running a Valgrind test.
44
+
You can test your own code with the [test script](https://github.com/pl3onasm/Imperative-programming/blob/main/ctest.sh). It will try to compile your code and run it on all the test cases. It will also compare your output with the expected output, and check for memory leaks by running a Valgrind test. If a test fails, the script will display the line number where there was a mismatch between the expected and the actual output, and the corresponding lines, so you can easily find the error. In order to avoid too much clutter, the script will only display the first 6 lines where mismatches were found.
45
45
46
46
In order to use it, you basically have two options:
47
47
@@ -81,26 +81,25 @@ Now you can run the script from the directory containing your program and the fo
81
81
ctest.sh myprogram.c
82
82
```
83
83
84
-
85
-
86
-
Note that if you want to use ```less```, you should add the -R flag:
87
-
88
-
```linux
89
-
ctest.sh myprogram.c | less -R
90
-
```
84
+
91
85
92
86
You may also choose to redirect the output to a file, in which case the color codes will be removed automatically to render a plain text file:
93
87
94
88
```linux
95
89
ctest.sh myprogram.c > results.txt
96
90
```
97
91
98
-
99
-
An output example of the test script:
100
-
92
+
## Notes
93
+
94
+
All commands were given with Ubuntu in mind. If you are using a different Linux distribution, you may need to change the commands accordingly.
95
+
96
+
The script was tested on Ubuntu 22.04 LTS, using GCC 13.1.0, Valgrind 3.18.1, and GNU bash 5.1.16(1)-release.
0 commit comments