mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[python] Test: add all template scripts
This commit is contained in:
committed by
LeaNumworks
parent
11dc259566
commit
ffb8f8f953
@@ -94,7 +94,7 @@ all_app_src = $(app_src)(apps_launch_on_boarding_src) $(apps_launch_default_src)
|
||||
$(call object_for,$(all_app_src)): $(BUILD_DIR)/apps/i18n.h
|
||||
$(call object_for,$(all_app_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h
|
||||
|
||||
apps_tests_src = $(app_calculation_test_src) $(app_probability_test_src) $(app_regression_test_src) $(app_sequence_test_src) $(app_shared_test_src) $(app_statistics_test_src) $(app_settings_test_src) $(app_solver_test_src)
|
||||
apps_tests_src = $(app_calculation_test_src) $(app_code_test_src) $(app_probability_test_src) $(app_regression_test_src) $(app_sequence_test_src) $(app_shared_test_src) $(app_statistics_test_src) $(app_settings_test_src) $(app_solver_test_src)
|
||||
|
||||
apps_tests_src += $(addprefix apps/,\
|
||||
global_preferences.cpp \
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
apps += Code::App
|
||||
app_headers += apps/code/app.h
|
||||
|
||||
app_code_test_src = $(addprefix apps/code/,\
|
||||
script_template.cpp \
|
||||
)
|
||||
|
||||
app_code_src = $(addprefix apps/code/,\
|
||||
app.cpp \
|
||||
console_controller.cpp \
|
||||
@@ -19,10 +23,10 @@ app_code_src = $(addprefix apps/code/,\
|
||||
script_node_cell.cpp \
|
||||
script_parameter_controller.cpp \
|
||||
script_store.cpp \
|
||||
script_template.cpp \
|
||||
variable_box_controller.cpp \
|
||||
)
|
||||
|
||||
app_code_src += $(app_code_test_src)
|
||||
app_src += $(app_code_src)
|
||||
|
||||
i18n_files += $(addprefix apps/code/,\
|
||||
|
||||
@@ -189,7 +189,7 @@ $(eval $(call rule_for, \
|
||||
$(call object_for,$(python_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h
|
||||
|
||||
tests_src += $(addprefix python/test/,\
|
||||
basics.cpp \
|
||||
execution_environment.cpp \
|
||||
mandelbrot.cpp \
|
||||
matplotlib.cpp \
|
||||
)
|
||||
|
||||
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