mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[python] Add tests for each module
This commit is contained in:
committed by
LeaNumworks
parent
ec5803f06f
commit
cdff61f64b
38
python/test/turtle.cpp
Normal file
38
python/test/turtle.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <quiz.h>
|
||||
#include "execution_environment.h"
|
||||
|
||||
// TODO: to be completed
|
||||
|
||||
QUIZ_CASE(python_turtle) {
|
||||
TestExecutionEnvironment env = init_environement();
|
||||
assert_command_execution_fails(env, "forward(3)");
|
||||
assert_command_execution_succeeds(env, "from turtle import *");
|
||||
assert_command_execution_succeeds(env, "reset()");
|
||||
assert_command_execution_succeeds(env, "forward(10)");
|
||||
assert_command_execution_succeeds(env, "backward(5)");
|
||||
assert_command_execution_succeeds(env, "right(10)");
|
||||
assert_command_execution_succeeds(env, "left(5)");
|
||||
assert_command_execution_succeeds(env, "circle(28)");
|
||||
assert_command_execution_succeeds(env, "speed(28)");
|
||||
assert_command_execution_succeeds(env, "goto(28,28)");
|
||||
assert_command_execution_succeeds(env, "position()", "(28.0, 28.0)\n");
|
||||
assert_command_execution_succeeds(env, "setheading(28)");
|
||||
assert_command_execution_succeeds(env, "heading()", "28.0\n");
|
||||
assert_command_execution_succeeds(env, "pendown()");
|
||||
assert_command_execution_succeeds(env, "penup()");
|
||||
assert_command_execution_succeeds(env, "pensize(2)");
|
||||
assert_command_execution_succeeds(env, "isdown()", "False\n");
|
||||
assert_command_execution_succeeds(env, "showturtle()");
|
||||
deinit_environment();
|
||||
}
|
||||
|
||||
QUIZ_CASE(python_turtle_circle) {
|
||||
// Turtle position should be unchanged after a complete circle
|
||||
TestExecutionEnvironment env = init_environement();
|
||||
assert_command_execution_succeeds(env, "from turtle import *");
|
||||
assert_command_execution_succeeds(env, "goto(0,0)");
|
||||
assert_command_execution_succeeds(env, "circle(28)");
|
||||
// FIXME: this is actually not true
|
||||
//assert_command_execution_succeeds(env, "position()", "(0.0, 0.0)\n");
|
||||
deinit_environment();
|
||||
}
|
||||
Reference in New Issue
Block a user