-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtc_71_2.c
46 lines (37 loc) · 1.63 KB
/
tc_71_2.c
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
#include "../test.h"
/**
* This test is a decently comprehensive executor sanity check (and a demonstration of the test framework's executor-testing abilities)
* It tests to make sure the testing framework can load student code from our testing folder, runs two coding challenges, does a basic
* test of Robot.run(), checks that both auto and teleop mode work, and checks that an error is outputted to the screen when a Python
* exception occurs.
*/
char check_output_6[] =
" File \"/home/runner/work/runtime/runtime/tests/student_code/executor_sanity.py\", line 25, in teleop_main\n"
" oops = 1 / 0\n"
" ~~^~~\n"
"ZeroDivisionError: division by zero\n";
int main() {
// set everything up
start_test("executor sanity test", "executor_sanity", NO_REGEX);
// poke the system
// this section checks the autonomous code (should generate some print statements)
send_start_pos(SHEPHERD, RIGHT);
add_ordered_string_output("Autonomous setup has begun!\n");
// Verify auto mode
send_run_mode(SHEPHERD, AUTO);
add_ordered_string_output("autonomous printing again\n");
sleep(1);
check_run_mode(AUTO);
// Verify idle mode
send_run_mode(SHEPHERD, IDLE);
sleep(1);
check_run_mode(IDLE);
// this section checks the teleop code (should generate division by zero error)
send_run_mode(SHEPHERD, TELEOP);
add_ordered_string_output("Traceback (most recent call last):\n");
add_ordered_string_output(check_output_6);
add_ordered_string_output("Python function teleop_main call failed\n");
check_run_mode(TELEOP);
send_run_mode(DAWN, IDLE);
return 0;
}