From 58d70f0ee681d3250831b8edc3d31c36821d4b5d Mon Sep 17 00:00:00 2001 From: ishan-monie Date: Tue, 18 Jun 2024 22:36:41 -0500 Subject: [PATCH] modified first 5 student_code tests --- tests/student_code/executor_sanity.py | 24 ++++++++++++++++++++++++ tests/student_code/keyboard_input.py | 17 ++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/student_code/executor_sanity.py b/tests/student_code/executor_sanity.py index 2d17be72..7cb644e1 100644 --- a/tests/student_code/executor_sanity.py +++ b/tests/student_code/executor_sanity.py @@ -1,3 +1,4 @@ +''' import time import math @@ -23,3 +24,26 @@ def teleop_setup(): def teleop_main(): oops = 1 / 0 +''' + +import time +import math + +# This autonomous code prints some output every two seconds + +def constant_print(msg): + while True: + print(f"{msg} printing again") + time.sleep(2) + +def autonomous(): + print('Autonomous has begun!') + print(f"Starting position: {Robot.start_pos}") + while True: + Robot.run(constant_print, "autonomous") + +# This teleop code generates a DivisionByZero Python error + +def teleop(): + while True: + oops = 1 / 0 diff --git a/tests/student_code/keyboard_input.py b/tests/student_code/keyboard_input.py index fe72d09f..0c92ed32 100644 --- a/tests/student_code/keyboard_input.py +++ b/tests/student_code/keyboard_input.py @@ -1,4 +1,4 @@ - +''' simple_device = "62_20" def autonomous_setup(): @@ -16,3 +16,18 @@ def teleop_main(): elif Keyboard.get_value('y'): print(Robot.get_value(simple_device, "MY_INT")) Robot.sleep(.45) +''' + +simple_device = "62_20" + +def autonomous(): + while True: + pass + +def teleop(): + while True: + if Keyboard.get_value('a'): + Robot.set_value(simple_device, "MY_INT", 123454321) + elif Keyboard.get_value('y'): + print(Robot.get_value(simple_device, "MY_INT")) + Robot.sleep(0.45)