Files
Upsilon/python/test/turtle.cpp
Yaya-Cout 169fb7404e Fix spelling (#128)
* Fix spelling in .cpp files

* Fix spelling in all files
2022-01-20 17:21:35 +01:00

39 lines
1.7 KiB
C++

#include <quiz.h>
#include "execution_environment.h"
// TODO: to be completed
QUIZ_CASE(python_turtle) {
TestExecutionEnvironment env = init_environnement();
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_environnement();
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();
}