mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[python] Test: add all template scripts
This commit is contained in:
committed by
LeaNumworks
parent
11dc259566
commit
ffb8f8f953
13
python/test/basics.cpp
Normal file
13
python/test/basics.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <quiz.h>
|
||||
#include "execution_environment.h"
|
||||
|
||||
QUIZ_CASE(python_basics) {
|
||||
assert_command_execution_succeeds("2+3","5\n");
|
||||
}
|
||||
|
||||
QUIZ_CASE(python_template) {
|
||||
assert_script_execution_succeeds(Code::ScriptTemplate::Squares()->content());
|
||||
assert_script_execution_succeeds(Code::ScriptTemplate::Mandelbrot()->content());
|
||||
assert_script_execution_succeeds(Code::ScriptTemplate::Polynomial()->content());
|
||||
assert_script_execution_succeeds(Code::ScriptTemplate::Parabola()->content());
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#include <quiz.h>
|
||||
#include "execution_environment.h"
|
||||
|
||||
static const char * s_mandelbrotScript = R"(#
|
||||
def mandelbrot(N_iteration):
|
||||
for x in range(320):
|
||||
for y in range(222):
|
||||
z = complex(0,0)
|
||||
c = complex(3.5*x/319-2.5, -2.5*y/221+1.25)
|
||||
i = 0
|
||||
while (i < N_iteration) and abs(z) < 2:
|
||||
i = i + 1
|
||||
z = z*z+c
|
||||
rgb = int(255*i/N_iteration)
|
||||
col = (int(rgb),int(rgb*0.75),int(rgb*0.25))
|
||||
mandelbrot(2)
|
||||
)";
|
||||
|
||||
QUIZ_CASE(python_mandelbrot) {
|
||||
assert_script_execution_succeeds(s_mandelbrotScript);
|
||||
}
|
||||
Reference in New Issue
Block a user