From 90fd0ff9f8af61324611737b98ddb08aa53d48cc Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 23 Feb 2016 10:23:55 -0600 Subject: [PATCH] Split test sims and fun sims into separate directories. Moved SIM_test_ip and a couple of other sims that depend on the same model set to a new test directory. I'm doing a couple of sims at a time. refs #191 --- Makefile | 1 + share/trick/makefiles/Makefile.common | 18 +- share/trick/makefiles/config_Linux.mk | 4 +- test/.gitignore | 26 + test/SIM_rti/RUN_test/unit_test.py | 1044 ++++++ test/SIM_rti/S_define | 37 + test/SIM_rti/S_overrides.mk | 2 + .../SIM_test_ip/Modified_data/auto_test.dr | 0 .../Modified_data/input_processor_tests.py | 0 .../Modified_data/nested_includes.py | 0 .../SIM_test_ip/Modified_data/next_level.py | 0 .../SIM_test_ip/Modified_data/test_print.py | 0 .../SIM_test_ip/RUN_test/Title | 0 test/SIM_test_ip/RUN_test/unit_test.py | 2993 ++++++++++++++++ {trick_sims => test}/SIM_test_ip/S_define | 44 +- test/SIM_test_ip/S_overrides.mk | 3 + {trick_sims => test}/SIM_test_ip/Title | 0 .../SIM_test_templates/RUN_test/unit_test.py | 0 .../SIM_test_templates/S_define | 0 test/SIM_test_templates/S_overrides.mk | 4 + {trick_sims => test}/SIM_test_templates/Title | 0 .../models}/exclude_me/include/exclude_me.hh | 0 .../test_ip/include/ClassOfEverything.hh | 40 +- .../test_ip/include/EmbeddedClasses.hh | 0 .../test_ip/include/Namespace_tests.hh | 15 +- test/models/test_ip/include/NoICG.hh | 24 + .../test_ip/include/OverloadedVariable.hh | 0 .../models}/test_ip/include/TemplateTest.hh | 15 +- test/models/test_ip/src/ClassOfEverything.cpp | 21 + trick_models/test_ip/include/NoICG.hh | 35 - trick_models/test_ip/src/Ball_test.cpp | 21 - trick_sims/SIM_rti/RUN_test/unit_test.py | 1054 ------ trick_sims/SIM_rti/S_define | 100 - trick_sims/SIM_rti/S_overrides.mk | 4 - trick_sims/SIM_test_ip/RUN_test/unit_test.py | 2995 ----------------- trick_sims/SIM_test_ip/S_overrides.mk | 4 - trick_sims/SIM_test_templates/S_overrides.mk | 4 - trick_sims/makefile | 6 - 38 files changed, 4187 insertions(+), 4327 deletions(-) create mode 100644 test/.gitignore create mode 100644 test/SIM_rti/RUN_test/unit_test.py create mode 100644 test/SIM_rti/S_define create mode 100644 test/SIM_rti/S_overrides.mk rename {trick_sims => test}/SIM_test_ip/Modified_data/auto_test.dr (100%) rename {trick_sims => test}/SIM_test_ip/Modified_data/input_processor_tests.py (100%) rename {trick_sims => test}/SIM_test_ip/Modified_data/nested_includes.py (100%) rename {trick_sims => test}/SIM_test_ip/Modified_data/next_level.py (100%) rename {trick_sims => test}/SIM_test_ip/Modified_data/test_print.py (100%) rename {trick_sims => test}/SIM_test_ip/RUN_test/Title (100%) create mode 100644 test/SIM_test_ip/RUN_test/unit_test.py rename {trick_sims => test}/SIM_test_ip/S_define (76%) create mode 100644 test/SIM_test_ip/S_overrides.mk rename {trick_sims => test}/SIM_test_ip/Title (100%) rename {trick_sims => test}/SIM_test_templates/RUN_test/unit_test.py (100%) rename {trick_sims => test}/SIM_test_templates/S_define (100%) create mode 100644 test/SIM_test_templates/S_overrides.mk rename {trick_sims => test}/SIM_test_templates/Title (100%) rename {trick_models => test/models}/exclude_me/include/exclude_me.hh (100%) rename trick_models/test_ip/include/Ball_test.hh => test/models/test_ip/include/ClassOfEverything.hh (92%) rename {trick_models => test/models}/test_ip/include/EmbeddedClasses.hh (100%) rename {trick_models => test/models}/test_ip/include/Namespace_tests.hh (68%) create mode 100644 test/models/test_ip/include/NoICG.hh rename {trick_models => test/models}/test_ip/include/OverloadedVariable.hh (100%) rename {trick_models => test/models}/test_ip/include/TemplateTest.hh (56%) create mode 100644 test/models/test_ip/src/ClassOfEverything.cpp delete mode 100644 trick_models/test_ip/include/NoICG.hh delete mode 100644 trick_models/test_ip/src/Ball_test.cpp delete mode 100644 trick_sims/SIM_rti/RUN_test/unit_test.py delete mode 100644 trick_sims/SIM_rti/S_define delete mode 100644 trick_sims/SIM_rti/S_overrides.mk delete mode 100644 trick_sims/SIM_test_ip/RUN_test/unit_test.py delete mode 100644 trick_sims/SIM_test_ip/S_overrides.mk delete mode 100644 trick_sims/SIM_test_templates/S_overrides.mk diff --git a/Makefile b/Makefile index 1f37a8f7..c103f5ba 100644 --- a/Makefile +++ b/Makefile @@ -283,6 +283,7 @@ $(UNIT_TEST_DIRS): unit_test: $(UNIT_TEST_DIRS) sim_test: + @ $(MAKE) -C test @ $(MAKE) -C trick_sims test #requirements: diff --git a/share/trick/makefiles/Makefile.common b/share/trick/makefiles/Makefile.common index 656a8709..7b74b363 100644 --- a/share/trick/makefiles/Makefile.common +++ b/share/trick/makefiles/Makefile.common @@ -63,11 +63,8 @@ else LIBEXEC = lib endif -# Do this section only once -ifeq ($(MAKELEVEL),0) - -export TRICK_INCLUDES := -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include -I${TRICK_HOME}/include/trick/compat -export TRICK_VERSIONS := -DTRICK_VER=$(TRICK_MAJOR) -DTRICK_MINOR=$(TRICK_MINOR) +TRICK_INCLUDES := -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include -I${TRICK_HOME}/include/trick/compat +TRICK_VERSIONS := -DTRICK_VER=$(TRICK_MAJOR) -DTRICK_MINOR=$(TRICK_MINOR) TRICK_SYSTEM_CFLAGS = $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic TRICK_SYSTEM_CXXFLAGS = $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic @@ -90,17 +87,12 @@ ifeq ($(USE_ER7_UTILS), 1) ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils TRICK_SYSTEM_CFLAGS += -DUSE_ER7_UTILS_INTEGRATORS TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS -ifneq ($(wildcard ${ER7_UTILS_HOME}/CheckpointHelper),) + TRICK_LIBS += -ler7_utils + ifneq ($(wildcard ${ER7_UTILS_HOME}/CheckpointHelper),) USE_ER7_UTILS_CHECKPOINTHELPER = 1 TRICK_SYSTEM_CFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER -endif -endif - -endif # MAKELEVEL = 0 - -ifeq ($(USE_ER7_UTILS), 1) - TRICK_LIBS += -ler7_utils + endif endif ifeq ($(TRICK_FORCE_32BIT), 1) diff --git a/share/trick/makefiles/config_Linux.mk b/share/trick/makefiles/config_Linux.mk index 2526bc90..b91fe69b 100644 --- a/share/trick/makefiles/config_Linux.mk +++ b/share/trick/makefiles/config_Linux.mk @@ -24,9 +24,7 @@ endif SHARED_LIB_OPT := -shared RPATH = -Wl,-rpath=${TRICK_LIB_DIR} -ifeq ($(MAKELEVEL),0) -export TRICK_LDFLAGS += -Wl,--export-dynamic -endif +TRICK_LDFLAGS = -Wl,--export-dynamic PLATFORM_LIBS = -lrt LD_WHOLE_ARCHIVE := -Wl,-whole-archive diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 00000000..6a327f9d --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,26 @@ +DP_rt_*.xml +makefile +S_job_execution +S_run_summary +send_hs +varserver_log +log_* +chkpnt_* +MONTE_RUN_* +.S_library* +.icg_no_found +CP_out +MAKE_out +Makefile_sim +Makefile_swig +S_default.dat +S_document.xml +S_library_list +S_main_* +S_sie.resource +S_source.cpp +S_source.hh +T_main_* +trick +jitlib +build diff --git a/test/SIM_rti/RUN_test/unit_test.py b/test/SIM_rti/RUN_test/unit_test.py new file mode 100644 index 00000000..0a353500 --- /dev/null +++ b/test/SIM_rti/RUN_test/unit_test.py @@ -0,0 +1,1044 @@ + +import math +from trick.unit_test import * + +def main(): + + trick.exec_set_terminate_time(1.0) + + trick_utest.unit_tests.enable() + trick_utest.unit_tests.set_file_name( os.getenv("TRICK_HOME") + "/trick_test/SIM_test_ip_rti.xml" ) + trick_utest.unit_tests.set_test_name( "RTI" ) + +###################################################################################################################### + + test_suite = "rti_add_int" + + test_so.obj.d = 0.0 + trick.rti_add("test_so.obj.d", 50) + test_so.obj.da[1] = 0.0 + trick.rti_add("test_so.obj.da[1]", 51) + test_so.obj.dp = trick.TMM_declare_var_s("double[6]") + trick.rti_add("test_so.obj.dp[1]", 52) + test_so.obj.daa[1][1] = 0.0 + trick.rti_add("test_so.obj.daa[1][1]", 53) + test_so.obj.dap[1] = trick.TMM_declare_var_1d( "double", 4) + trick.rti_add("test_so.obj.dap[1][1]", 54) + test_so.obj.dpp = trick.TMM_declare_var_s("double *[4]") + test_so.obj.dpp[1] = trick.TMM_declare_var_1d( "double", 5) + trick.rti_add("test_so.obj.dpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_NEAR( test_so.obj.d , 50.0 , 0.000001 , test_suite , "double" ) + TRICK_EXPECT_NEAR( test_so.obj.da[1] , 51.0 , 0.000001 , test_suite , "double array" ) + TRICK_EXPECT_NEAR( test_so.obj.dp[1] , 52.0 , 0.000001 , test_suite , "double pointer" ) + TRICK_EXPECT_NEAR( test_so.obj.daa[1][1] , 53.0 , 0.000001 , test_suite , "2D double array" ) + TRICK_EXPECT_NEAR( test_so.obj.dap[1][1] , 54.0 , 0.000001 , test_suite , "2D double array of ptr" ) + TRICK_EXPECT_NEAR( test_so.obj.dpp[1][1] , 55.0 , 0.000001 , test_suite , "2D double ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.f = 0.0 + trick.rti_add("test_so.obj.f", 50) + test_so.obj.fa[1] = 0.0 + trick.rti_add("test_so.obj.fa[1]", 51) + test_so.obj.fp = trick.TMM_declare_var_s("float[6]") + trick.rti_add("test_so.obj.fp[1]", 52) + test_so.obj.faa[1][1] = 0.0 + trick.rti_add("test_so.obj.faa[1][1]", 53) + test_so.obj.fap[1] = trick.TMM_declare_var_1d( "float", 4) + trick.rti_add("test_so.obj.fap[1][1]", 54) + test_so.obj.fpp = trick.TMM_declare_var_s("float *[4]") + test_so.obj.fpp[1] = trick.TMM_declare_var_1d( "float", 5) + trick.rti_add("test_so.obj.fpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_NEAR( test_so.obj.f , 50.0 , 0.000001 , test_suite , "float" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[1] , 51.0 , 0.000001 , test_suite , "float array" ) + TRICK_EXPECT_NEAR( test_so.obj.fp[1] , 52.0 , 0.000001 , test_suite , "float pointer" ) + TRICK_EXPECT_NEAR( test_so.obj.faa[1][1] , 53.0 , 0.000001 , test_suite , "2D float array" ) + TRICK_EXPECT_NEAR( test_so.obj.fap[1][1] , 54.0 , 0.000001 , test_suite , "2D float array of ptr" ) + TRICK_EXPECT_NEAR( test_so.obj.fpp[1][1] , 55.0 , 0.000001 , test_suite , "2D float ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.c = 0 + trick.rti_add("test_so.obj.c", 50) + test_so.obj.ca[1] = 0 + trick.rti_add("test_so.obj.ca[1]", 51) + test_so.obj.cp = trick.TMM_declare_var_s("char[6]") + trick.rti_add("test_so.obj.cp[1]", 52) + test_so.obj.caa[1][1] = 0 + trick.rti_add("test_so.obj.caa[1][1]", 53) + test_so.obj.cap[1] = trick.TMM_declare_var_1d( "char", 4) + trick.rti_add("test_so.obj.cap[1][1]", 54) + test_so.obj.cpp = trick.TMM_declare_var_s("char *[4]") + test_so.obj.cpp[1] = trick.TMM_declare_var_1d( "char", 5) + trick.rti_add("test_so.obj.cpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.c , 50 , test_suite , "char" ) + TRICK_EXPECT_EQ( test_so.obj.ca[1] , 51 , test_suite , "char array" ) + TRICK_EXPECT_EQ( test_so.obj.cp[1] , 52 , test_suite , "char pointer" ) + TRICK_EXPECT_EQ( test_so.obj.caa[1][1] , 53 , test_suite , "2D char array" ) + TRICK_EXPECT_EQ( test_so.obj.cap[1][1] , 54 , test_suite , "2D char array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.cpp[1][1] , 55 , test_suite , "2D char ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.uc = 0 + trick.rti_add("test_so.obj.uc", 50) + test_so.obj.uca[1] = 0 + trick.rti_add("test_so.obj.uca[1]", 51) + test_so.obj.ucp = trick.TMM_declare_var_s("unsigned char[6]") + trick.rti_add("test_so.obj.ucp[1]", 52) + test_so.obj.ucaa[1][1] = 0 + trick.rti_add("test_so.obj.ucaa[1][1]", 53) + test_so.obj.ucap[1] = trick.TMM_declare_var_1d( "unsigned char", 4) + trick.rti_add("test_so.obj.ucap[1][1]", 54) + test_so.obj.ucpp = trick.TMM_declare_var_s("unsigned char *[4]") + test_so.obj.ucpp[1] = trick.TMM_declare_var_1d( "unsigned char", 5) + trick.rti_add("test_so.obj.ucpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.uc , 50 , test_suite , "unsigned char" ) + TRICK_EXPECT_EQ( test_so.obj.uca[1] , 51 , test_suite , "unsigned char array" ) + TRICK_EXPECT_EQ( test_so.obj.ucp[1] , 52 , test_suite , "unsigned char pointer" ) + TRICK_EXPECT_EQ( test_so.obj.ucaa[1][1] , 53 , test_suite , "2D unsigned char array" ) + TRICK_EXPECT_EQ( test_so.obj.ucap[1][1] , 54 , test_suite , "2D unsigned char array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ucpp[1][1] , 55 , test_suite , "2D unsigned char ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.s = 0 + trick.rti_add("test_so.obj.s", 50) + test_so.obj.sa[1] = 0 + trick.rti_add("test_so.obj.sa[1]", 51) + test_so.obj.sp = trick.TMM_declare_var_s("short[6]") + trick.rti_add("test_so.obj.sp[1]", 52) + test_so.obj.saa[1][1] = 0 + trick.rti_add("test_so.obj.saa[1][1]", 53) + test_so.obj.sap[1] = trick.TMM_declare_var_1d( "short", 4) + trick.rti_add("test_so.obj.sap[1][1]", 54) + test_so.obj.spp = trick.TMM_declare_var_s("short *[4]") + test_so.obj.spp[1] = trick.TMM_declare_var_1d( "short", 5) + trick.rti_add("test_so.obj.spp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.s , 50 , test_suite , "short" ) + TRICK_EXPECT_EQ( test_so.obj.sa[1] , 51 , test_suite , "short array" ) + TRICK_EXPECT_EQ( test_so.obj.sp[1] , 52 , test_suite , "short pointer" ) + TRICK_EXPECT_EQ( test_so.obj.saa[1][1] , 53 , test_suite , "2D short array" ) + TRICK_EXPECT_EQ( test_so.obj.sap[1][1] , 54 , test_suite , "2D short array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.spp[1][1] , 55 , test_suite , "2D short ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.us = 0 + trick.rti_add("test_so.obj.us", 50) + test_so.obj.usa[1] = 0 + trick.rti_add("test_so.obj.usa[1]", 51) + test_so.obj.usp = trick.TMM_declare_var_s("unsigned short[6]") + trick.rti_add("test_so.obj.usp[1]", 52) + test_so.obj.usaa[1][1] = 0 + trick.rti_add("test_so.obj.usaa[1][1]", 53) + test_so.obj.usap[1] = trick.TMM_declare_var_1d( "unsigned short", 4) + trick.rti_add("test_so.obj.usap[1][1]", 54) + test_so.obj.uspp = trick.TMM_declare_var_s("unsigned short *[4]") + test_so.obj.uspp[1] = trick.TMM_declare_var_1d( "unsigned short", 5) + trick.rti_add("test_so.obj.uspp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.us , 50 , test_suite , "unsigned short" ) + TRICK_EXPECT_EQ( test_so.obj.usa[1] , 51 , test_suite , "unsigned short array" ) + TRICK_EXPECT_EQ( test_so.obj.usp[1] , 52 , test_suite , "unsigned short pointer" ) + TRICK_EXPECT_EQ( test_so.obj.usaa[1][1] , 53 , test_suite , "2D unsigned short array" ) + TRICK_EXPECT_EQ( test_so.obj.usap[1][1] , 54 , test_suite , "2D unsigned short array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.uspp[1][1] , 55 , test_suite , "2D unsigned short ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.i = 0 + trick.rti_add("test_so.obj.i", 50) + test_so.obj.ia[1] = 0 + trick.rti_add("test_so.obj.ia[1]", 51) + test_so.obj.ip = trick.TMM_declare_var_s("int[6]") + trick.rti_add("test_so.obj.ip[1]", 52) + test_so.obj.iaa[1][1] = 0 + trick.rti_add("test_so.obj.iaa[1][1]", 53) + test_so.obj.iap[1] = trick.TMM_declare_var_1d( "int", 4) + trick.rti_add("test_so.obj.iap[1][1]", 54) + test_so.obj.ipp = trick.TMM_declare_var_s("int *[4]") + test_so.obj.ipp[1] = trick.TMM_declare_var_1d( "int", 5) + trick.rti_add("test_so.obj.ipp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.i , 50 , test_suite , "int" ) + TRICK_EXPECT_EQ( test_so.obj.ia[1] , 51 , test_suite , "int array" ) + TRICK_EXPECT_EQ( test_so.obj.ip[1] , 52 , test_suite , "int pointer" ) + TRICK_EXPECT_EQ( test_so.obj.iaa[1][1] , 53 , test_suite , "2D int array" ) + TRICK_EXPECT_EQ( test_so.obj.iap[1][1] , 54 , test_suite , "2D int array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ipp[1][1] , 55 , test_suite , "2D int ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ui = 0 + trick.rti_add("test_so.obj.ui", 50) + test_so.obj.uia[1] = 0 + trick.rti_add("test_so.obj.uia[1]", 51) + test_so.obj.uip = trick.TMM_declare_var_s("unsigned int[6]") + trick.rti_add("test_so.obj.uip[1]", 52) + test_so.obj.uiaa[1][1] = 0 + trick.rti_add("test_so.obj.uiaa[1][1]", 53) + test_so.obj.uiap[1] = trick.TMM_declare_var_1d( "unsigned int", 4) + trick.rti_add("test_so.obj.uiap[1][1]", 54) + test_so.obj.uipp = trick.TMM_declare_var_s("unsigned int *[4]") + test_so.obj.uipp[1] = trick.TMM_declare_var_1d( "unsigned int", 5) + trick.rti_add("test_so.obj.uipp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ui , 50 , test_suite , "unsigned int" ) + TRICK_EXPECT_EQ( test_so.obj.uia[1] , 51 , test_suite , "unsigned int array" ) + TRICK_EXPECT_EQ( test_so.obj.uip[1] , 52 , test_suite , "unsigned int pointer" ) + TRICK_EXPECT_EQ( test_so.obj.uiaa[1][1] , 53 , test_suite , "2D unsigned int array" ) + TRICK_EXPECT_EQ( test_so.obj.uiap[1][1] , 54 , test_suite , "2D unsigned int array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.uipp[1][1] , 55 , test_suite , "2D unsigned int ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.l = 0 + trick.rti_add("test_so.obj.l", 50) + test_so.obj.la[1] = 0 + trick.rti_add("test_so.obj.la[1]", 51) + test_so.obj.lp = trick.TMM_declare_var_s("long[6]") + trick.rti_add("test_so.obj.lp[1]", 52) + test_so.obj.laa[1][1] = 0 + trick.rti_add("test_so.obj.laa[1][1]", 53) + test_so.obj.lap[1] = trick.TMM_declare_var_1d( "long", 4) + trick.rti_add("test_so.obj.lap[1][1]", 54) + test_so.obj.lpp = trick.TMM_declare_var_s("long *[4]") + test_so.obj.lpp[1] = trick.TMM_declare_var_1d( "long", 5) + trick.rti_add("test_so.obj.lpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.l , 50 , test_suite , "long" ) + TRICK_EXPECT_EQ( test_so.obj.la[1] , 51 , test_suite , "long array" ) + TRICK_EXPECT_EQ( test_so.obj.lp[1] , 52 , test_suite , "long polonger" ) + TRICK_EXPECT_EQ( test_so.obj.laa[1][1] , 53 , test_suite , "2D long array" ) + TRICK_EXPECT_EQ( test_so.obj.lap[1][1] , 54 , test_suite , "2D long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.lpp[1][1] , 55 , test_suite , "2D long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ul = 0 + trick.rti_add("test_so.obj.ul", 50) + test_so.obj.ula[1] = 0 + trick.rti_add("test_so.obj.ula[1]", 51) + test_so.obj.ulp = trick.TMM_declare_var_s("unsigned long[6]") + trick.rti_add("test_so.obj.ulp[1]", 52) + test_so.obj.ulaa[1][1] = 0 + trick.rti_add("test_so.obj.ulaa[1][1]", 53) + test_so.obj.ulap[1] = trick.TMM_declare_var_1d( "unsigned long", 4) + trick.rti_add("test_so.obj.ulap[1][1]", 54) + test_so.obj.ulpp = trick.TMM_declare_var_s("unsigned long *[4]") + test_so.obj.ulpp[1] = trick.TMM_declare_var_1d( "unsigned long", 5) + trick.rti_add("test_so.obj.ulpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ul , 50 , test_suite , "unsigned long" ) + TRICK_EXPECT_EQ( test_so.obj.ula[1] , 51 , test_suite , "unsigned long array" ) + TRICK_EXPECT_EQ( test_so.obj.ulp[1] , 52 , test_suite , "unsigned long pointer" ) + TRICK_EXPECT_EQ( test_so.obj.ulaa[1][1] , 53 , test_suite , "2D unsigned long array" ) + TRICK_EXPECT_EQ( test_so.obj.ulap[1][1] , 54 , test_suite , "2D unsigned long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ulpp[1][1] , 55 , test_suite , "2D unsigned long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ll = 0 + trick.rti_add("test_so.obj.ll", 50) + test_so.obj.lla[1] = 0 + trick.rti_add("test_so.obj.lla[1]", 51) + test_so.obj.llp = trick.TMM_declare_var_s("long long[6]") + trick.rti_add("test_so.obj.llp[1]", 52) + test_so.obj.llaa[1][1] = 0 + trick.rti_add("test_so.obj.llaa[1][1]", 53) + test_so.obj.llap[1] = trick.TMM_declare_var_1d( "long long", 4) + trick.rti_add("test_so.obj.llap[1][1]", 54) + test_so.obj.llpp = trick.TMM_declare_var_s("long long *[4]") + test_so.obj.llpp[1] = trick.TMM_declare_var_1d( "long long", 5) + trick.rti_add("test_so.obj.llpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ll , 50 , test_suite , "long long" ) + TRICK_EXPECT_EQ( test_so.obj.lla[1] , 51 , test_suite , "long long array" ) + TRICK_EXPECT_EQ( test_so.obj.llp[1] , 52 , test_suite , "long long pointer" ) + TRICK_EXPECT_EQ( test_so.obj.llaa[1][1] , 53 , test_suite , "2D long long array" ) + TRICK_EXPECT_EQ( test_so.obj.llap[1][1] , 54 , test_suite , "2D long long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.llpp[1][1] , 55 , test_suite , "2D long long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ull = 0 + trick.rti_add("test_so.obj.ull", 50) + test_so.obj.ulla[1] = 0 + trick.rti_add("test_so.obj.ulla[1]", 51) + test_so.obj.ullp = trick.TMM_declare_var_s("unsigned long long[6]") + trick.rti_add("test_so.obj.ullp[1]", 52) + test_so.obj.ullaa[1][1] = 0 + trick.rti_add("test_so.obj.ullaa[1][1]", 53) + test_so.obj.ullap[1] = trick.TMM_declare_var_1d( "unsigned long long", 4) + trick.rti_add("test_so.obj.ullap[1][1]", 54) + test_so.obj.ullpp = trick.TMM_declare_var_s("unsigned long long *[4]") + test_so.obj.ullpp[1] = trick.TMM_declare_var_1d( "unsigned long long", 5) + trick.rti_add("test_so.obj.ullpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ull , 50 , test_suite , "unsigned long long" ) + TRICK_EXPECT_EQ( test_so.obj.ulla[1] , 51 , test_suite , "unsigned long long array" ) + TRICK_EXPECT_EQ( test_so.obj.ullp[1] , 52 , test_suite , "unsigned long long pointer" ) + TRICK_EXPECT_EQ( test_so.obj.ullaa[1][1] , 53 , test_suite , "2D unsigned long long array" ) + TRICK_EXPECT_EQ( test_so.obj.ullap[1][1] , 54 , test_suite , "2D unsigned long long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ullpp[1][1] , 55 , test_suite , "2D unsigned long long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.e = 0 + trick.rti_add("test_so.obj.e", 50) + test_so.obj.ea[1] = 0 + trick.rti_add("test_so.obj.ea[1]", 51) + test_so.obj.ep = trick.TMM_declare_var_s("MY_ENUM[6]") + trick.rti_add("test_so.obj.ep[1]", 52) + test_so.obj.eaa[1][1] = 0 + trick.rti_add("test_so.obj.eaa[1][1]", 53) + test_so.obj.eap[1] = trick.TMM_declare_var_1d( "MY_ENUM", 4) + trick.rti_add("test_so.obj.eap[1][1]", 54) + test_so.obj.epp = trick.TMM_declare_var_s("MY_ENUM *[4]") + test_so.obj.epp[1] = trick.TMM_declare_var_1d( "MY_ENUM", 5) + trick.rti_add("test_so.obj.epp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.e , 50 , test_suite , "enum" ) + TRICK_EXPECT_EQ( test_so.obj.ea[1] , 51 , test_suite , "enum array" ) + TRICK_EXPECT_EQ( test_so.obj.ep[1] , 52 , test_suite , "enum pointer" ) + TRICK_EXPECT_EQ( test_so.obj.eaa[1][1] , 53 , test_suite , "2D enum array" ) + TRICK_EXPECT_EQ( test_so.obj.eap[1][1] , 54 , test_suite , "2D enum array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.epp[1][1] , 55 , test_suite , "2D enum ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.b = 0 + trick.rti_add("test_so.obj.b", 50) + test_so.obj.ba[1] = 0 + trick.rti_add("test_so.obj.ba[1]", 51) + test_so.obj.bp = trick.TMM_declare_var_s("bool[6]") + trick.rti_add("test_so.obj.bp[1]", 52) + test_so.obj.baa[1][1] = 0 + trick.rti_add("test_so.obj.baa[1][1]", 53) + test_so.obj.bap[1] = trick.TMM_declare_var_1d( "bool", 4) + trick.rti_add("test_so.obj.bap[1][1]", 54) + test_so.obj.bpp = trick.TMM_declare_var_s("bool *[4]") + test_so.obj.bpp[1] = trick.TMM_declare_var_1d( "bool", 5) + trick.rti_add("test_so.obj.bpp[1][1]", 55) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.b , 1 , test_suite , "bool" ) + TRICK_EXPECT_EQ( test_so.obj.ba[1] , 1 , test_suite , "bool array" ) + TRICK_EXPECT_EQ( test_so.obj.bp[1] , 1 , test_suite , "bool pointer" ) + TRICK_EXPECT_EQ( test_so.obj.baa[1][1] , 1 , test_suite , "2D bool array" ) + TRICK_EXPECT_EQ( test_so.obj.bap[1][1] , 1 , test_suite , "2D bool array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.bpp[1][1] , 1 , test_suite , "2D bool ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.cbit_0 = 0 + trick.rti_add("test_so.obj.cbit_0", -1) + test_so.obj.cbit_1 = 0 + trick.rti_add("test_so.obj.cbit_1", 31) + test_so.obj.cbit_2 = 0 + trick.rti_add("test_so.obj.cbit_2", 2) + + test_so.obj.ucbit_0 = 0 + trick.rti_add("test_so.obj.ucbit_0", 2) + test_so.obj.ucbit_1 = 0 + trick.rti_add("test_so.obj.ucbit_1", 31) + test_so.obj.ucbit_2 = 0 + trick.rti_add("test_so.obj.ucbit_2", -1) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + print os.uname()[4] + # The raspberry pi has a bug and returns bitfields in unsigned format. + if os.uname()[4] == 'armv6l': + TRICK_EXPECT_EQ( test_so.obj.cbit_0 , 3 , test_suite , "char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.cbit_1 , 7 , test_suite , "char bitfield" ) + else : + TRICK_EXPECT_EQ( test_so.obj.cbit_0 , -1 , test_suite , "char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.cbit_1 , -1 , test_suite , "char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.cbit_2 , 2 , test_suite , "char bitfield" ) + + TRICK_EXPECT_EQ( test_so.obj.ucbit_0 , 2 , test_suite , "unsigned char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ucbit_1 , 7 , test_suite , "unsigned char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ucbit_2 , 7 , test_suite , "unsigned char bitfield" ) + +###################################################################################################################### + + test_so.obj.sbit_0 = 0 + trick.rti_add("test_so.obj.sbit_0", -1) + test_so.obj.sbit_1 = 0 + trick.rti_add("test_so.obj.sbit_1", 255) + test_so.obj.sbit_2 = 0 + trick.rti_add("test_so.obj.sbit_2", 2) + + test_so.obj.usbit_0 = 0 + trick.rti_add("test_so.obj.usbit_0", 2) + test_so.obj.usbit_1 = 0 + trick.rti_add("test_so.obj.usbit_1", 255) + test_so.obj.usbit_2 = 0 + trick.rti_add("test_so.obj.usbit_2", -1) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.sbit_0 , -1 , test_suite , "short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.sbit_1 , -1 , test_suite , "short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.sbit_2 , 2 , test_suite , "short bitfield" ) + + TRICK_EXPECT_EQ( test_so.obj.usbit_0 , 2 , test_suite , "unsigned short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.usbit_1 , 31 , test_suite , "unsigned short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.usbit_2 , 127 , test_suite , "unsigned short bitfield" ) + +###################################################################################################################### + + test_so.obj.bit_0 = 0 + trick.rti_add("test_so.obj.bit_0", -1) + test_so.obj.bit_1 = 0 + trick.rti_add("test_so.obj.bit_1", 255) + test_so.obj.bit_2 = 0 + trick.rti_add("test_so.obj.bit_2", 2) + + test_so.obj.ubit_0 = 0 + trick.rti_add("test_so.obj.ubit_0", 2) + test_so.obj.ubit_1 = 0 + trick.rti_add("test_so.obj.ubit_1", 255) + test_so.obj.ubit_2 = 0 + trick.rti_add("test_so.obj.ubit_2", -1) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.bit_0 , -1 , test_suite , "int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.bit_1 , -1 , test_suite , "int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.bit_2 , 2 , test_suite , "int bitfield" ) + + TRICK_EXPECT_EQ( test_so.obj.ubit_0 , 2 , test_suite , "unsigned int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ubit_1 , 31 , test_suite , "unsigned int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ubit_2 , 63 , test_suite , "unsigned int bitfield" ) + +###################################################################################################################### + + # long and long long bitfields are not currently supported by + # sim_services/MemoryManager/src/insert_bitfield_any.c + + #test_so.obj.lbit_0 = 0 + #trick.rti_add("test_so.obj.lbit_0", -1) + #test_so.obj.lbit_1 = 0 + #trick.rti_add("test_so.obj.lbit_1", 255) + #test_so.obj.lbit_2 = 0 + #trick.rti_add("test_so.obj.lbit_2", 2) + + #test_so.obj.ulbit_0 = 0 + #trick.rti_add("test_so.obj.ulbit_0", 2) + #test_so.obj.ulbit_1 = 0 + #trick.rti_add("test_so.obj.ulbit_1", 255) + #test_so.obj.ulbit_2 = 0 + #trick.rti_add("test_so.obj.ulbit_2", -1) + + #trick.rti_fire() + #trick_inject.rtis.GetRtiExecutor(0).Exec() + + #TRICK_EXPECT_EQ( test_so.obj.lbit_0 , -1 , test_suite , "long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.lbit_1 , -1 , test_suite , "long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.lbit_2 , 2 , test_suite , "long bitfield" ) + + #TRICK_EXPECT_EQ( test_so.obj.ulbit_0 , 2 , test_suite , "unsigned long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.ulbit_1 , 31 , test_suite , "unsigned long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.ulbit_2 , 63 , test_suite , "unsigned long bitfield" ) + +###################################################################################################################### + + test_so.obj.boolbit_0 = 0 + trick.rti_add("test_so.obj.boolbit_0", 2) + test_so.obj.boolbit_1 = 0 + trick.rti_add("test_so.obj.boolbit_1", 1) + test_so.obj.boolbit_2 = 0 + trick.rti_add("test_so.obj.boolbit_2", 255) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.boolbit_0 , 0 , test_suite , "bool bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.boolbit_1 , 1 , test_suite , "bool bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.boolbit_2 , 1 , test_suite , "bool bitfield" ) + +###################################################################################################################### +###################################################################################################################### + + test_suite = "rti_add_float" + + test_so.obj.d = 0.0 + trick.rti_add("test_so.obj.d", 50.1) + test_so.obj.da[1] = 0.0 + trick.rti_add("test_so.obj.da[1]", 51.1) + test_so.obj.dp = trick.TMM_declare_var_s("double[6]") + trick.rti_add("test_so.obj.dp[1]", 52.1) + test_so.obj.daa[1][1] = 0.0 + trick.rti_add("test_so.obj.daa[1][1]", 53.1) + test_so.obj.dap[1] = trick.TMM_declare_var_1d( "double", 4) + trick.rti_add("test_so.obj.dap[1][1]", 54.1) + test_so.obj.dpp = trick.TMM_declare_var_s("double *[4]") + test_so.obj.dpp[1] = trick.TMM_declare_var_1d( "double", 5) + trick.rti_add("test_so.obj.dpp[1][1]", 55.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_NEAR( test_so.obj.d , 50.1 , 0.000001 , test_suite , "double" ) + TRICK_EXPECT_NEAR( test_so.obj.da[1] , 51.1 , 0.000001 , test_suite , "double array" ) + TRICK_EXPECT_NEAR( test_so.obj.dp[1] , 52.1 , 0.000001 , test_suite , "double pointer" ) + TRICK_EXPECT_NEAR( test_so.obj.daa[1][1] , 53.1 , 0.000001 , test_suite , "2D double array" ) + TRICK_EXPECT_NEAR( test_so.obj.dap[1][1] , 54.1 , 0.000001 , test_suite , "2D double array of ptr" ) + TRICK_EXPECT_NEAR( test_so.obj.dpp[1][1] , 55.1 , 0.000001 , test_suite , "2D double ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.f = 0.0 + trick.rti_add("test_so.obj.f", 50.1) + test_so.obj.fa[1] = 0.0 + trick.rti_add("test_so.obj.fa[1]", 51.1) + test_so.obj.fp = trick.TMM_declare_var_s("float[6]") + trick.rti_add("test_so.obj.fp[1]", 52.1) + test_so.obj.faa[1][1] = 0.0 + trick.rti_add("test_so.obj.faa[1][1]", 53.1) + test_so.obj.fap[1] = trick.TMM_declare_var_1d( "float", 4) + trick.rti_add("test_so.obj.fap[1][1]", 54.1) + test_so.obj.fpp = trick.TMM_declare_var_s("float *[4]") + test_so.obj.fpp[1] = trick.TMM_declare_var_1d( "float", 5) + trick.rti_add("test_so.obj.fpp[1][1]", 55.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_NEAR( test_so.obj.f , 50.1 , 0.00001 , test_suite , "float" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[1] , 51.1 , 0.00001 , test_suite , "float array" ) + TRICK_EXPECT_NEAR( test_so.obj.fp[1] , 52.1 , 0.00001 , test_suite , "float pointer" ) + TRICK_EXPECT_NEAR( test_so.obj.faa[1][1] , 53.1 , 0.00001 , test_suite , "2D float array" ) + TRICK_EXPECT_NEAR( test_so.obj.fap[1][1] , 54.1 , 0.00001 , test_suite , "2D float array of ptr" ) + TRICK_EXPECT_NEAR( test_so.obj.fpp[1][1] , 55.1 , 0.00001 , test_suite , "2D float ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.c = 0 + trick.rti_add("test_so.obj.c", 40.1) + test_so.obj.ca[1] = 0 + trick.rti_add("test_so.obj.ca[1]", 41.1) + test_so.obj.cp = trick.TMM_declare_var_s("char[6]") + trick.rti_add("test_so.obj.cp[1]", 42.1) + test_so.obj.caa[1][1] = 0 + trick.rti_add("test_so.obj.caa[1][1]", 43.1) + test_so.obj.cap[1] = trick.TMM_declare_var_1d( "char", 4) + trick.rti_add("test_so.obj.cap[1][1]", 44.1) + test_so.obj.cpp = trick.TMM_declare_var_s("char *[4]") + test_so.obj.cpp[1] = trick.TMM_declare_var_1d( "char", 5) + trick.rti_add("test_so.obj.cpp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.c , 40 , test_suite , "char" ) + TRICK_EXPECT_EQ( test_so.obj.ca[1] , 41 , test_suite , "char array" ) + TRICK_EXPECT_EQ( test_so.obj.cp[1] , 42 , test_suite , "char pointer" ) + TRICK_EXPECT_EQ( test_so.obj.caa[1][1] , 43 , test_suite , "2D char array" ) + TRICK_EXPECT_EQ( test_so.obj.cap[1][1] , 44 , test_suite , "2D char array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.cpp[1][1] , 45 , test_suite , "2D char ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.uc = 0 + trick.rti_add("test_so.obj.uc", 40.1) + test_so.obj.uca[1] = 0 + trick.rti_add("test_so.obj.uca[1]", 41.1) + test_so.obj.ucp = trick.TMM_declare_var_s("unsigned char[6]") + trick.rti_add("test_so.obj.ucp[1]", 42.1) + test_so.obj.ucaa[1][1] = 0 + trick.rti_add("test_so.obj.ucaa[1][1]", 43.1) + test_so.obj.ucap[1] = trick.TMM_declare_var_1d( "unsigned char", 4) + trick.rti_add("test_so.obj.ucap[1][1]", 44.1) + test_so.obj.ucpp = trick.TMM_declare_var_s("unsigned char *[4]") + test_so.obj.ucpp[1] = trick.TMM_declare_var_1d( "unsigned char", 5) + trick.rti_add("test_so.obj.ucpp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.uc , 40 , test_suite , "unsigned char" ) + TRICK_EXPECT_EQ( test_so.obj.uca[1] , 41 , test_suite , "unsigned char array" ) + TRICK_EXPECT_EQ( test_so.obj.ucp[1] , 42 , test_suite , "unsigned char pointer" ) + TRICK_EXPECT_EQ( test_so.obj.ucaa[1][1] , 43 , test_suite , "2D unsigned char array" ) + TRICK_EXPECT_EQ( test_so.obj.ucap[1][1] , 44 , test_suite , "2D unsigned char array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ucpp[1][1] , 45 , test_suite , "2D unsigned char ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.s = 0 + trick.rti_add("test_so.obj.s", 40.1) + test_so.obj.sa[1] = 0 + trick.rti_add("test_so.obj.sa[1]", 41.1) + test_so.obj.sp = trick.TMM_declare_var_s("short[6]") + trick.rti_add("test_so.obj.sp[1]", 42.1) + test_so.obj.saa[1][1] = 0 + trick.rti_add("test_so.obj.saa[1][1]", 43.1) + test_so.obj.sap[1] = trick.TMM_declare_var_1d( "short", 4) + trick.rti_add("test_so.obj.sap[1][1]", 44.1) + test_so.obj.spp = trick.TMM_declare_var_s("short *[4]") + test_so.obj.spp[1] = trick.TMM_declare_var_1d( "short", 5) + trick.rti_add("test_so.obj.spp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.s , 40 , test_suite , "short" ) + TRICK_EXPECT_EQ( test_so.obj.sa[1] , 41 , test_suite , "short array" ) + TRICK_EXPECT_EQ( test_so.obj.sp[1] , 42 , test_suite , "short pointer" ) + TRICK_EXPECT_EQ( test_so.obj.saa[1][1] , 43 , test_suite , "2D short array" ) + TRICK_EXPECT_EQ( test_so.obj.sap[1][1] , 44 , test_suite , "2D short array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.spp[1][1] , 45 , test_suite , "2D short ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.us = 0 + trick.rti_add("test_so.obj.us", 40.1) + test_so.obj.usa[1] = 0 + trick.rti_add("test_so.obj.usa[1]", 41.1) + test_so.obj.usp = trick.TMM_declare_var_s("unsigned short[6]") + trick.rti_add("test_so.obj.usp[1]", 42.1) + test_so.obj.usaa[1][1] = 0 + trick.rti_add("test_so.obj.usaa[1][1]", 43.1) + test_so.obj.usap[1] = trick.TMM_declare_var_1d( "unsigned short", 4) + trick.rti_add("test_so.obj.usap[1][1]", 44.1) + test_so.obj.uspp = trick.TMM_declare_var_s("unsigned short *[4]") + test_so.obj.uspp[1] = trick.TMM_declare_var_1d( "unsigned short", 5) + trick.rti_add("test_so.obj.uspp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.us , 40 , test_suite , "unsigned short" ) + TRICK_EXPECT_EQ( test_so.obj.usa[1] , 41 , test_suite , "unsigned short array" ) + TRICK_EXPECT_EQ( test_so.obj.usp[1] , 42 , test_suite , "unsigned short pointer" ) + TRICK_EXPECT_EQ( test_so.obj.usaa[1][1] , 43 , test_suite , "2D unsigned short array" ) + TRICK_EXPECT_EQ( test_so.obj.usap[1][1] , 44 , test_suite , "2D unsigned short array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.uspp[1][1] , 45 , test_suite , "2D unsigned short ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.i = 0 + trick.rti_add("test_so.obj.i", 40.1) + test_so.obj.ia[1] = 0 + trick.rti_add("test_so.obj.ia[1]", 41.1) + test_so.obj.ip = trick.TMM_declare_var_s("int[6]") + trick.rti_add("test_so.obj.ip[1]", 42.1) + test_so.obj.iaa[1][1] = 0 + trick.rti_add("test_so.obj.iaa[1][1]", 43.1) + test_so.obj.iap[1] = trick.TMM_declare_var_1d( "int", 4) + trick.rti_add("test_so.obj.iap[1][1]", 44.1) + test_so.obj.ipp = trick.TMM_declare_var_s("int *[4]") + test_so.obj.ipp[1] = trick.TMM_declare_var_1d( "int", 5) + trick.rti_add("test_so.obj.ipp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.i , 40 , test_suite , "int" ) + TRICK_EXPECT_EQ( test_so.obj.ia[1] , 41 , test_suite , "int array" ) + TRICK_EXPECT_EQ( test_so.obj.ip[1] , 42 , test_suite , "int pointer" ) + TRICK_EXPECT_EQ( test_so.obj.iaa[1][1] , 43 , test_suite , "2D int array" ) + TRICK_EXPECT_EQ( test_so.obj.iap[1][1] , 44 , test_suite , "2D int array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ipp[1][1] , 45 , test_suite , "2D int ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ui = 0 + trick.rti_add("test_so.obj.ui", 40.1) + test_so.obj.uia[1] = 0 + trick.rti_add("test_so.obj.uia[1]", 41.1) + test_so.obj.uip = trick.TMM_declare_var_s("unsigned int[6]") + trick.rti_add("test_so.obj.uip[1]", 42.1) + test_so.obj.uiaa[1][1] = 0 + trick.rti_add("test_so.obj.uiaa[1][1]", 43.1) + test_so.obj.uiap[1] = trick.TMM_declare_var_1d( "unsigned int", 4) + trick.rti_add("test_so.obj.uiap[1][1]", 44.1) + test_so.obj.uipp = trick.TMM_declare_var_s("unsigned int *[4]") + test_so.obj.uipp[1] = trick.TMM_declare_var_1d( "unsigned int", 5) + trick.rti_add("test_so.obj.uipp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ui , 40 , test_suite , "unsigned int" ) + TRICK_EXPECT_EQ( test_so.obj.uia[1] , 41 , test_suite , "unsigned int array" ) + TRICK_EXPECT_EQ( test_so.obj.uip[1] , 42 , test_suite , "unsigned int pointer" ) + TRICK_EXPECT_EQ( test_so.obj.uiaa[1][1] , 43 , test_suite , "2D unsigned int array" ) + TRICK_EXPECT_EQ( test_so.obj.uiap[1][1] , 44 , test_suite , "2D unsigned int array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.uipp[1][1] , 45 , test_suite , "2D unsigned int ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.l = 0 + trick.rti_add("test_so.obj.l", 40.1) + test_so.obj.la[1] = 0 + trick.rti_add("test_so.obj.la[1]", 41.1) + test_so.obj.lp = trick.TMM_declare_var_s("long[6]") + trick.rti_add("test_so.obj.lp[1]", 42.1) + test_so.obj.laa[1][1] = 0 + trick.rti_add("test_so.obj.laa[1][1]", 43.1) + test_so.obj.lap[1] = trick.TMM_declare_var_1d( "long", 4) + trick.rti_add("test_so.obj.lap[1][1]", 44.1) + test_so.obj.lpp = trick.TMM_declare_var_s("long *[4]") + test_so.obj.lpp[1] = trick.TMM_declare_var_1d( "long", 5) + trick.rti_add("test_so.obj.lpp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.l , 40 , test_suite , "long" ) + TRICK_EXPECT_EQ( test_so.obj.la[1] , 41 , test_suite , "long array" ) + TRICK_EXPECT_EQ( test_so.obj.lp[1] , 42 , test_suite , "long polonger" ) + TRICK_EXPECT_EQ( test_so.obj.laa[1][1] , 43 , test_suite , "2D long array" ) + TRICK_EXPECT_EQ( test_so.obj.lap[1][1] , 44 , test_suite , "2D long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.lpp[1][1] , 45 , test_suite , "2D long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ul = 0 + trick.rti_add("test_so.obj.ul", 40.1) + test_so.obj.ula[1] = 0 + trick.rti_add("test_so.obj.ula[1]", 41.1) + test_so.obj.ulp = trick.TMM_declare_var_s("unsigned long[6]") + trick.rti_add("test_so.obj.ulp[1]", 42.1) + test_so.obj.ulaa[1][1] = 0 + trick.rti_add("test_so.obj.ulaa[1][1]", 43.1) + test_so.obj.ulap[1] = trick.TMM_declare_var_1d( "unsigned long", 4) + trick.rti_add("test_so.obj.ulap[1][1]", 44.1) + test_so.obj.ulpp = trick.TMM_declare_var_s("unsigned long *[4]") + test_so.obj.ulpp[1] = trick.TMM_declare_var_1d( "unsigned long", 5) + trick.rti_add("test_so.obj.ulpp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ul , 40 , test_suite , "unsigned long" ) + TRICK_EXPECT_EQ( test_so.obj.ula[1] , 41 , test_suite , "unsigned long array" ) + TRICK_EXPECT_EQ( test_so.obj.ulp[1] , 42 , test_suite , "unsigned long pointer" ) + TRICK_EXPECT_EQ( test_so.obj.ulaa[1][1] , 43 , test_suite , "2D unsigned long array" ) + TRICK_EXPECT_EQ( test_so.obj.ulap[1][1] , 44 , test_suite , "2D unsigned long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ulpp[1][1] , 45 , test_suite , "2D unsigned long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ll = 0 + trick.rti_add("test_so.obj.ll", 40.1) + test_so.obj.lla[1] = 0 + trick.rti_add("test_so.obj.lla[1]", 41.1) + test_so.obj.llp = trick.TMM_declare_var_s("long long[6]") + trick.rti_add("test_so.obj.llp[1]", 42.1) + test_so.obj.llaa[1][1] = 0 + trick.rti_add("test_so.obj.llaa[1][1]", 43.1) + test_so.obj.llap[1] = trick.TMM_declare_var_1d( "long long", 4) + trick.rti_add("test_so.obj.llap[1][1]", 44.1) + test_so.obj.llpp = trick.TMM_declare_var_s("long long *[4]") + test_so.obj.llpp[1] = trick.TMM_declare_var_1d( "long long", 5) + trick.rti_add("test_so.obj.llpp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ll , 40 , test_suite , "long long" ) + TRICK_EXPECT_EQ( test_so.obj.lla[1] , 41 , test_suite , "long long array" ) + TRICK_EXPECT_EQ( test_so.obj.llp[1] , 42 , test_suite , "long long pointer" ) + TRICK_EXPECT_EQ( test_so.obj.llaa[1][1] , 43 , test_suite , "2D long long array" ) + TRICK_EXPECT_EQ( test_so.obj.llap[1][1] , 44 , test_suite , "2D long long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.llpp[1][1] , 45 , test_suite , "2D long long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.ull = 0 + trick.rti_add("test_so.obj.ull", 40.1) + test_so.obj.ulla[1] = 0 + trick.rti_add("test_so.obj.ulla[1]", 41.1) + test_so.obj.ullp = trick.TMM_declare_var_s("unsigned long long[6]") + trick.rti_add("test_so.obj.ullp[1]", 42.1) + test_so.obj.ullaa[1][1] = 0 + trick.rti_add("test_so.obj.ullaa[1][1]", 43.1) + test_so.obj.ullap[1] = trick.TMM_declare_var_1d( "unsigned long long", 4) + trick.rti_add("test_so.obj.ullap[1][1]", 44.1) + test_so.obj.ullpp = trick.TMM_declare_var_s("unsigned long long *[4]") + test_so.obj.ullpp[1] = trick.TMM_declare_var_1d( "unsigned long long", 5) + trick.rti_add("test_so.obj.ullpp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.ull , 40 , test_suite , "unsigned long long" ) + TRICK_EXPECT_EQ( test_so.obj.ulla[1] , 41 , test_suite , "unsigned long long array" ) + TRICK_EXPECT_EQ( test_so.obj.ullp[1] , 42 , test_suite , "unsigned long long pointer" ) + TRICK_EXPECT_EQ( test_so.obj.ullaa[1][1] , 43 , test_suite , "2D unsigned long long array" ) + TRICK_EXPECT_EQ( test_so.obj.ullap[1][1] , 44 , test_suite , "2D unsigned long long array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.ullpp[1][1] , 45 , test_suite , "2D unsigned long long ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.e = 0 + trick.rti_add("test_so.obj.e", 40.1) + test_so.obj.ea[1] = 0 + trick.rti_add("test_so.obj.ea[1]", 41.1) + test_so.obj.ep = trick.TMM_declare_var_s("MY_ENUM[6]") + trick.rti_add("test_so.obj.ep[1]", 42.1) + test_so.obj.eaa[1][1] = 0 + trick.rti_add("test_so.obj.eaa[1][1]", 43.1) + test_so.obj.eap[1] = trick.TMM_declare_var_1d( "MY_ENUM", 4) + trick.rti_add("test_so.obj.eap[1][1]", 44.1) + test_so.obj.epp = trick.TMM_declare_var_s("MY_ENUM *[4]") + test_so.obj.epp[1] = trick.TMM_declare_var_1d( "MY_ENUM", 5) + trick.rti_add("test_so.obj.epp[1][1]", 45.1) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.e , 40 , test_suite , "enum" ) + TRICK_EXPECT_EQ( test_so.obj.ea[1] , 41 , test_suite , "enum array" ) + TRICK_EXPECT_EQ( test_so.obj.ep[1] , 42 , test_suite , "enum pointer" ) + TRICK_EXPECT_EQ( test_so.obj.eaa[1][1] , 43 , test_suite , "2D enum array" ) + TRICK_EXPECT_EQ( test_so.obj.eap[1][1] , 44 , test_suite , "2D enum array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.epp[1][1] , 45 , test_suite , "2D enum ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.b = 0 + trick.rti_add("test_so.obj.b", 40) + test_so.obj.ba[1] = 0 + trick.rti_add("test_so.obj.ba[1]", 41) + test_so.obj.bp = trick.TMM_declare_var_s("bool[6]") + trick.rti_add("test_so.obj.bp[1]", 42) + test_so.obj.baa[1][1] = 0 + trick.rti_add("test_so.obj.baa[1][1]", 43) + test_so.obj.bap[1] = trick.TMM_declare_var_1d( "bool", 4) + trick.rti_add("test_so.obj.bap[1][1]", 44) + test_so.obj.bpp = trick.TMM_declare_var_s("bool *[4]") + test_so.obj.bpp[1] = trick.TMM_declare_var_1d( "bool", 5) + trick.rti_add("test_so.obj.bpp[1][1]", 45) + + #trick.rti_list() + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.b , 1 , test_suite , "bool" ) + TRICK_EXPECT_EQ( test_so.obj.ba[1] , 1 , test_suite , "bool array" ) + TRICK_EXPECT_EQ( test_so.obj.bp[1] , 1 , test_suite , "bool pointer" ) + TRICK_EXPECT_EQ( test_so.obj.baa[1][1] , 1 , test_suite , "2D bool array" ) + TRICK_EXPECT_EQ( test_so.obj.bap[1][1] , 1 , test_suite , "2D bool array of ptr" ) + TRICK_EXPECT_EQ( test_so.obj.bpp[1][1] , 1 , test_suite , "2D bool ptr of ptr" ) + +###################################################################################################################### + + test_so.obj.cbit_0 = 0 + trick.rti_add("test_so.obj.cbit_0", -1) + test_so.obj.cbit_1 = 0 + trick.rti_add("test_so.obj.cbit_1", 31) + test_so.obj.cbit_2 = 0 + trick.rti_add("test_so.obj.cbit_2", 2) + + test_so.obj.ucbit_0 = 0 + trick.rti_add("test_so.obj.ucbit_0", 2) + test_so.obj.ucbit_1 = 0 + trick.rti_add("test_so.obj.ucbit_1", 31) + test_so.obj.ucbit_2 = 0 + trick.rti_add("test_so.obj.ucbit_2", -1) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + # The raspberry pi has a bug and returns bitfields in unsigned format. + if os.uname()[4] == 'armv61': + TRICK_EXPECT_EQ( test_so.obj.cbit_0 , 3 , test_suite , "char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.cbit_1 , 7 , test_suite , "char bitfield" ) + else : + TRICK_EXPECT_EQ( test_so.obj.cbit_0 , -1 , test_suite , "char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.cbit_1 , -1 , test_suite , "char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.cbit_2 , 2 , test_suite , "char bitfield" ) + + TRICK_EXPECT_EQ( test_so.obj.ucbit_0 , 2 , test_suite , "unsigned char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ucbit_1 , 7 , test_suite , "unsigned char bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ucbit_2 , 7 , test_suite , "unsigned char bitfield" ) + +###################################################################################################################### + + test_so.obj.sbit_0 = 0 + trick.rti_add("test_so.obj.sbit_0", -1) + test_so.obj.sbit_1 = 0 + trick.rti_add("test_so.obj.sbit_1", 255) + test_so.obj.sbit_2 = 0 + trick.rti_add("test_so.obj.sbit_2", 2) + + test_so.obj.usbit_0 = 0 + trick.rti_add("test_so.obj.usbit_0", 2) + test_so.obj.usbit_1 = 0 + trick.rti_add("test_so.obj.usbit_1", 255) + test_so.obj.usbit_2 = 0 + trick.rti_add("test_so.obj.usbit_2", -1) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.sbit_0 , -1 , test_suite , "short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.sbit_1 , -1 , test_suite , "short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.sbit_2 , 2 , test_suite , "short bitfield" ) + + TRICK_EXPECT_EQ( test_so.obj.usbit_0 , 2 , test_suite , "unsigned short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.usbit_1 , 31 , test_suite , "unsigned short bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.usbit_2 , 127 , test_suite , "unsigned short bitfield" ) + +###################################################################################################################### + + test_so.obj.bit_0 = 0 + trick.rti_add("test_so.obj.bit_0", -1) + test_so.obj.bit_1 = 0 + trick.rti_add("test_so.obj.bit_1", 255) + test_so.obj.bit_2 = 0 + trick.rti_add("test_so.obj.bit_2", 2) + + test_so.obj.ubit_0 = 0 + trick.rti_add("test_so.obj.ubit_0", 2) + test_so.obj.ubit_1 = 0 + trick.rti_add("test_so.obj.ubit_1", 255) + test_so.obj.ubit_2 = 0 + trick.rti_add("test_so.obj.ubit_2", -1) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.bit_0 , -1 , test_suite , "int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.bit_1 , -1 , test_suite , "int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.bit_2 , 2 , test_suite , "int bitfield" ) + + TRICK_EXPECT_EQ( test_so.obj.ubit_0 , 2 , test_suite , "unsigned int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ubit_1 , 31 , test_suite , "unsigned int bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.ubit_2 , 63 , test_suite , "unsigned int bitfield" ) + +###################################################################################################################### + + # long and long long bitfields are not currently supported by + # sim_services/MemoryManager/src/insert_bitfield_any.c + + #test_so.obj.lbit_0 = 0 + #trick.rti_add("test_so.obj.lbit_0", -1) + #test_so.obj.lbit_1 = 0 + #trick.rti_add("test_so.obj.lbit_1", 255) + #test_so.obj.lbit_2 = 0 + #trick.rti_add("test_so.obj.lbit_2", 2) + + #test_so.obj.ulbit_0 = 0 + #trick.rti_add("test_so.obj.ulbit_0", 2) + #test_so.obj.ulbit_1 = 0 + #trick.rti_add("test_so.obj.ulbit_1", 255) + #test_so.obj.ulbit_2 = 0 + #trick.rti_add("test_so.obj.ulbit_2", -1) + + #trick.rti_fire() + #trick_inject.rtis.GetRtiExecutor(0).Exec() + + #TRICK_EXPECT_EQ( test_so.obj.lbit_0 , -1 , test_suite , "long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.lbit_1 , -1 , test_suite , "long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.lbit_2 , 2 , test_suite , "long bitfield" ) + + #TRICK_EXPECT_EQ( test_so.obj.ulbit_0 , 2 , test_suite , "unsigned long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.ulbit_1 , 31 , test_suite , "unsigned long bitfield" ) + #TRICK_EXPECT_EQ( test_so.obj.ulbit_2 , 63 , test_suite , "unsigned long bitfield" ) + +###################################################################################################################### + + test_so.obj.boolbit_0 = 0 + trick.rti_add("test_so.obj.boolbit_0", 2) + test_so.obj.boolbit_1 = 0 + trick.rti_add("test_so.obj.boolbit_1", 1) + test_so.obj.boolbit_2 = 0 + trick.rti_add("test_so.obj.boolbit_2", 255) + + trick.rti_fire() + trick_inject.rtis.GetRtiExecutor(0).Exec() + + TRICK_EXPECT_EQ( test_so.obj.boolbit_0 , 0 , test_suite , "bool bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.boolbit_1 , 1 , test_suite , "bool bitfield" ) + TRICK_EXPECT_EQ( test_so.obj.boolbit_2 , 1 , test_suite , "bool bitfield" ) + +###################################################################################################################### + +if __name__ == "__main__": + + main() + diff --git a/test/SIM_rti/S_define b/test/SIM_rti/S_define new file mode 100644 index 00000000..643fc0a8 --- /dev/null +++ b/test/SIM_rti/S_define @@ -0,0 +1,37 @@ +/************************TRICK HEADER************************* +PURPOSE: + (This comment lists out the other object files that are not included from c++ headers) +LIBRARY DEPENDENCIES: + ( + ) +*************************************************************/ + +#include "sim_objects/default_trick_sys.sm" +##include "test_ip/include/ClassOfEverything.hh" + +class testSimObject : public Trick::SimObject { + + public: + ClassOfEverything obj ; + TEST_STRUCT t ; + my_ns::AA ns_test ; + + testSimObject() {} + + private: + testSimObject (const testSimObject &); + testSimObject & operator= (const testSimObject &); + +} ; + +// Instantiations +testSimObject test_so ; + +// Connect objects +void create_connections() { + + // Set the default termination time + trick_sys.sched.set_terminate_time(1.0) ; + trick_sys.sched.set_freeze_frame(0.10) ; +} + diff --git a/test/SIM_rti/S_overrides.mk b/test/SIM_rti/S_overrides.mk new file mode 100644 index 00000000..ce5861e6 --- /dev/null +++ b/test/SIM_rti/S_overrides.mk @@ -0,0 +1,2 @@ +TRICK_CFLAGS += -I../models +TRICK_CXXFLAGS += -I../models diff --git a/trick_sims/SIM_test_ip/Modified_data/auto_test.dr b/test/SIM_test_ip/Modified_data/auto_test.dr similarity index 100% rename from trick_sims/SIM_test_ip/Modified_data/auto_test.dr rename to test/SIM_test_ip/Modified_data/auto_test.dr diff --git a/trick_sims/SIM_test_ip/Modified_data/input_processor_tests.py b/test/SIM_test_ip/Modified_data/input_processor_tests.py similarity index 100% rename from trick_sims/SIM_test_ip/Modified_data/input_processor_tests.py rename to test/SIM_test_ip/Modified_data/input_processor_tests.py diff --git a/trick_sims/SIM_test_ip/Modified_data/nested_includes.py b/test/SIM_test_ip/Modified_data/nested_includes.py similarity index 100% rename from trick_sims/SIM_test_ip/Modified_data/nested_includes.py rename to test/SIM_test_ip/Modified_data/nested_includes.py diff --git a/trick_sims/SIM_test_ip/Modified_data/next_level.py b/test/SIM_test_ip/Modified_data/next_level.py similarity index 100% rename from trick_sims/SIM_test_ip/Modified_data/next_level.py rename to test/SIM_test_ip/Modified_data/next_level.py diff --git a/trick_sims/SIM_test_ip/Modified_data/test_print.py b/test/SIM_test_ip/Modified_data/test_print.py similarity index 100% rename from trick_sims/SIM_test_ip/Modified_data/test_print.py rename to test/SIM_test_ip/Modified_data/test_print.py diff --git a/trick_sims/SIM_test_ip/RUN_test/Title b/test/SIM_test_ip/RUN_test/Title similarity index 100% rename from trick_sims/SIM_test_ip/RUN_test/Title rename to test/SIM_test_ip/RUN_test/Title diff --git a/test/SIM_test_ip/RUN_test/unit_test.py b/test/SIM_test_ip/RUN_test/unit_test.py new file mode 100644 index 00000000..4139de68 --- /dev/null +++ b/test/SIM_test_ip/RUN_test/unit_test.py @@ -0,0 +1,2993 @@ + +import math +from trick.unit_test import * + +def main(): + + # These are here as a reference for the add_collect syntax... I have changed the code to not use collect + # An example of removing collect in the input file (original collect added in S_define file) + #test_so.obj.state.work.external_force = trick.delete_collect(test_so.obj.state.work.external_force, test_so.obj.force.output.force) + # An example of adding a collect in the input file + #test_so.obj.state.work.external_force = trick.add_collect(test_so.obj.state.work.external_force, test_so.obj.force.output.force) + + # An example of turning off a sim_object + trick.exec_set_sim_object_onoff("disabled_obj" , False) + + trick.exec_set_terminate_time(1.0) + + trick_utest.unit_tests.enable() + trick_utest.unit_tests.set_file_name( os.getenv("TRICK_HOME") + "/trick_test/SIM_test_ip.xml" ) + trick_utest.unit_tests.set_test_name( "IPtest" ) + +###################################################################################################################### + + test_suite = "double" + + test_so.obj.d = 2 + TRICK_EXPECT_NEAR( test_so.obj.d , 2.0 , 0.000001 , test_suite , "no units" ) + trick.trick_test_add_parent( test_suite , "no units" , "910635102") + + test_so.obj.d = trick.attach_units("lbm" , 2) + TRICK_EXPECT_NEAR( test_so.obj.d , 0.907185 , 0.000001 , test_suite , "units convert" ) + + test_so.obj.da = [ 20 , 21 , 22 ] + TRICK_EXPECT_NEAR( test_so.obj.da[0] , 20 , 0.000001 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.da[1] , 21 , 0.000001 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.da[2] , 22 , 0.000001 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.da = [ 30.1 , 31.1 , 32.1 ] + + TRICK_EXPECT_NEAR( test_so.obj.da[0] , 30.1 , 0.000001 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.da[1] , 31.1 , 0.000001 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.da[2] , 32.1 , 0.000001 , test_suite , "1D array, float value, no units" ) + + test_so.obj.da = 40.1 , 41.1 , 42.1 + + TRICK_EXPECT_NEAR( test_so.obj.da[0] , 40.1 , 0.000001 , test_suite , "1D array, tuple float value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.da[1] , 41.1 , 0.000001 , test_suite , "1D array, tuple float value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.da[2] , 42.1 , 0.000001 , test_suite , "1D array, tuple float value, no units" ) + + test_so.obj.da = trick.attach_units("lbm" , [2 , 3 , 4]) + TRICK_EXPECT_NEAR( test_so.obj.da[0] , 0.907185 , 0.000001 , test_suite , "1D array, float value, units convert" ) + TRICK_EXPECT_NEAR( test_so.obj.da[1] , 1.36078 , 0.00001 , test_suite , "1D array, float value, units convert" ) + TRICK_EXPECT_NEAR( test_so.obj.da[2] , 1.81437 , 0.00001 , test_suite , "1D array, float value, units convert" ) + + test_so.obj.dp = trick.TMM_declare_var_s("double[6]") + TRICK_EXPECT_NEAR( test_so.obj.dp[0] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_NEAR( test_so.obj.dp[5] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "1D ptr, allocation" ) + + test_so.obj.dp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[30 kg, 31 kg, 32 kg, 33 kg]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.dp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[30 kg, 31 kg, 62 kg, 33 kg]", test_suite , "1D ptr, partial assign, no units" ) + + TRICK_EXPECT_EQ( test_so.obj.dp[-1], 33, test_suite , "negative index integer value" ) + TRICK_EXPECT_EQ( test_so.obj.dp[-1.0], 33, test_suite , "negative index float value" ) + + test_so.obj.dp[-1] = 55 + test_so.obj.dp[-2] = 54 + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[30 kg, 31 kg, 54 kg, 55 kg]", test_suite , "negative index assignments" ) + + test_so.obj.dp = None + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + # Mixed tuple/list notation + test_so.obj.daa = trick.attach_units( "kg", (( 50 , 51 , 52) , [53, 54, 55]) ) + TRICK_EXPECT_EQ( str(test_so.obj.daa) , "[[50 kg, 51 kg, 52 kg],[53 kg, 54 kg, 55 kg]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.daa = trick.attach_units( "kg", [[ 40 , 41 , 42] , [43, 44, 45]] ) + TRICK_EXPECT_EQ( str(test_so.obj.daa) , "[[40 kg, 41 kg, 42 kg],[43 kg, 44 kg, 45 kg]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.daa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.daa) , "[[40 kg, 41 kg, 42 kg],[50 kg, 51 kg, 52 kg]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.daa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.daa) , "[[40 kg, 41 kg, 42 kg],[50.1 kg, 51.2 kg, 52.3 kg]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.daa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.daa) , "[[40 kg, 41 kg, 42 kg],[50.1 kg, 60 kg, 52.3 kg]]", + test_suite , "2D array, single assign, no units" ) + + test_so.obj.daa[0] = trick.attach_units( "lbm",[ 4.0, 5.0, 6.0]) + TRICK_EXPECT_EQ( str(test_so.obj.daa[0]) , "[1.814369479104077 kg, 2.267961848880096 kg, 2.721554218656115 kg]", + test_suite , "2D array, single single row assignment with units conversion" ) + + TRICK_EXPECT_EQ( str(test_so.obj.dap) , "[NULL, NULL, NULL, NULL]", test_suite , "2D array of ptr, initial value" ) + + test_so.obj.dap[0] = trick.TMM_declare_var_1d( "double", 3) + test_so.obj.dap[1] = trick.TMM_declare_var_1d( "double", 4) + test_so.obj.dap[2] = trick.TMM_declare_var_1d( "double", 5) + test_so.obj.dap[3] = trick.TMM_declare_var_1d( "double", 6) + + TRICK_EXPECT_EQ( str(test_so.obj.dap[0]) , "[0 kg, 0 kg, 0 kg]", test_suite , "2D array of ptr, single row access" ) + + test_so.obj.dap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.dap[3]) , "[60 kg, 61 kg, 62 kg, 63 kg]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.dap[3][1] = 75 + test_so.obj.dap[3][3] = trick.attach_units("lbm", float(test_so.obj.dap[3][3]) + 1.0) + + TRICK_EXPECT_EQ( str(test_so.obj.dap[3]) , "[60 kg, 75 kg, 62 kg, 29.02991166566523 kg]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.dpp = trick.TMM_declare_var_s("double *[4]") + TRICK_EXPECT_EQ( str(test_so.obj.dpp) , "[NULL, NULL, NULL, NULL]", test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.dpp[0] = trick.TMM_declare_var_1d( "double", 5) + TRICK_EXPECT_EQ( str(test_so.obj.dpp[0]) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.dpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.dpp[0]) , "[0 kg, 85 kg, 0 kg, 0 kg, 0 kg]", + test_suite , "2D ptr of ptr, scalar assignment" ) + + test_so.obj.dpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.dpp[1]) , "[91 kg, 92 kg, 93 kg]", + test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.dpp[2] = trick.attach_units("lbm" , [ 91 , 92 , 93 , 94 , 95]) + TRICK_EXPECT_NEAR( test_so.obj.dpp[2][0] , 41.276905 , 0.000001 , + test_suite , "2D ptr of ptr, united value" ) + + test_so.obj.dpp = None + TRICK_EXPECT_EQ( str(test_so.obj.dpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + + test_so.obj.daaa[0][0] = [1, 2, 3, 4] + test_so.obj.daaa[0][1] = [5, 6, 7, 8] + test_so.obj.daaa[0][2][0] = 9 + test_so.obj.daaa[0][2][1] = 10 + test_so.obj.daaa[0][2][2] = 11 + test_so.obj.daaa[0][2][3] = 12 + # 2D assignment fails with error message but does not exit sim. :( + #test_so.obj.daaa[1][0] = [[101, 102, 103, 104] , [105, 106, 107, 108] , [109, 110, 111, 112]] + TRICK_EXPECT_EQ( str(test_so.obj.daaa[0]) , "[[1 kg, 2 kg, 3 kg, 4 kg],[5 kg, 6 kg, 7 kg, 8 kg],[9 kg, 10 kg, 11 kg, 12 kg]]", + test_suite , "3D array, list and scalar assignment" ) + + # 4D assignment array is not supported yet + #test_so.obj.daaaa[0][0][0] = [51, 52, 53, 54, 55] + +###################################################################################################################### + + test_suite = "float" + + test_so.obj.f = 2 + TRICK_EXPECT_NEAR( test_so.obj.f , 2.0 , 0.000001 , test_suite , "no units" ) + trick.trick_test_add_parent( test_suite , "no units" , "1532242077") + + test_so.obj.f = trick.attach_units("lbm" , 2) + TRICK_EXPECT_NEAR( test_so.obj.f , 0.907185 , 0.000001 , test_suite , "units convert" ) + + test_so.obj.fa = [ 20 , 21 , 22 ] + TRICK_EXPECT_NEAR( test_so.obj.fa[0] , 20 , 0.000001 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[1] , 21 , 0.000001 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[2] , 22 , 0.000001 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.fa = [ 30.1 , 31.1 , 32.1 ] + + TRICK_EXPECT_NEAR( test_so.obj.fa[0] , 30.1 , 0.0001 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[1] , 31.1 , 0.0001 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[2] , 32.1 , 0.0001 , test_suite , "1D array, float value, no units" ) + + test_so.obj.fa = trick.attach_units("lbm" , [2 , 3 , 4]) + TRICK_EXPECT_NEAR( test_so.obj.fa[0] , 0.907185 , 0.000001 , test_suite , "1D array, float value, units convert" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[1] , 1.36078 , 0.00001 , test_suite , "1D array, float value, units convert" ) + TRICK_EXPECT_NEAR( test_so.obj.fa[2] , 1.81437 , 0.00001 , test_suite , "1D array, float value, units convert" ) + + test_so.obj.fp = trick.alloc_type( 6 , "float") + TRICK_EXPECT_NEAR( test_so.obj.fp[0] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_NEAR( test_so.obj.fp[5] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.fp) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "1D ptr, allocation" ) + + test_so.obj.fp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.fp) , "[30 kg, 31 kg, 32 kg, 33 kg]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.fp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.fp) , "[30 kg, 31 kg, 62 kg, 33 kg]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.fp = None + TRICK_EXPECT_EQ( str(test_so.obj.fp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.faa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.faa) , "[[40 kg, 41 kg, 42 kg],[43 kg, 44 kg, 45 kg]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.faa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.faa) , "[[40 kg, 41 kg, 42 kg],[50 kg, 51 kg, 52 kg]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.faa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.faa) , "[[40 kg, 41 kg, 42 kg],[50.099998 kg, 51.200001 kg, 52.299999 kg]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.faa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.faa) , "[[40 kg, 41 kg, 42 kg],[50.099998 kg, 60 kg, 52.299999 kg]]", + test_suite , "2D array, partial assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.fap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.fap[0] = trick.alloc_type( 3 , "float") + test_so.obj.fap[1] = trick.alloc_type( 4 , "float") + test_so.obj.fap[2] = trick.alloc_type( 5 , "float") + test_so.obj.fap[3] = trick.alloc_type( 6 , "float") + TRICK_EXPECT_EQ( str(test_so.obj.fap[0]) , "[0 kg, 0 kg, 0 kg]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.fap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.fap[3]) , "[60 kg, 61 kg, 62 kg, 63 kg]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.fap[3][1] = 75 + test_so.obj.fap[3][3] = trick.attach_units("lbm", float(test_so.obj.fap[3][3]) + 1.0) + + TRICK_EXPECT_EQ( str(test_so.obj.fap[3]) , "[60 kg, 75 kg, 62 kg, 29.029911 kg]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.fpp = trick.alloc_type( 4 , "float *") + TRICK_EXPECT_EQ( str(test_so.obj.fpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.fpp[0] = trick.alloc_type( 5 , "float") + TRICK_EXPECT_EQ( str(test_so.obj.fpp[0]) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.fpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.fpp[0]) , "[0 kg, 85 kg, 0 kg, 0 kg, 0 kg]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.fpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.fpp[1]) , "[91 kg, 92 kg, 93 kg]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.fpp = None + TRICK_EXPECT_EQ( str(test_so.obj.fpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + + test_so.obj.f_rad = 2.0 + TRICK_EXPECT_NEAR( test_so.obj.f_rad , 2.0 , 0.000001 , test_suite , "no units" ) + + test_so.obj.f_rad = trick.attach_units("d" , 45.0) + TRICK_EXPECT_NEAR( test_so.obj.f_rad , 0.785398 , 0.000001 , test_suite , "unit conv" ) + + test_so.obj.d_deg = test_so.obj.f_rad + TRICK_EXPECT_NEAR( test_so.obj.d_deg , 45.0 , 0.00001 , test_suite , "value to value assign with conversion" ) + +###################################################################################################################### + + test_suite = "char" + + test_so.obj.c = 'g' + TRICK_EXPECT_EQ( str(test_so.obj.c) , "103", test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "2896569040") + + test_so.obj.c = 123 + TRICK_EXPECT_EQ( str(test_so.obj.c) , "123", test_suite , "assignment" ) + + test_so.obj.ca = "Trick is great" + TRICK_EXPECT_EQ( str(test_so.obj.ca) , "Trick is great", test_suite , "arrray assignment" ) + + test_so.obj.ca = [65, 66, 67, 68, 69] + TRICK_EXPECT_EQ( str(test_so.obj.ca) , "ABCDE", test_suite , "arrray assignment" ) + + test_so.obj.ca = [65.1, 66.2, 67.3, 68.4, 69.6] + TRICK_EXPECT_EQ( str(test_so.obj.ca) , "ABCDE", test_suite , "arrray assignment" ) + TRICK_EXPECT_EQ( test_so.obj.ca[3] , 68 , test_suite , "arrray assignment" ) + + test_so.obj.cp = trick.alloc_type( 6 , "char") + TRICK_EXPECT_EQ( test_so.obj.cp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.cp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.cp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.cp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.cp) , "[30, 31, ' ', '!']", test_suite , "float 1D ptr, list assign, no units" ) + + test_so.obj.cp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.cp) , "[30, 31, '>', '!']", test_suite , "float 1D ptr, partial assign, no units" ) + + + test_so.obj.cp = "testing" + TRICK_EXPECT_EQ( str(test_so.obj.cp) , "testing", test_suite , "ptr assignment" ) + + test_so.obj.cp = None + TRICK_EXPECT_EQ( str(test_so.obj.cp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.caa = [ "abcdefg" , "hijklmn" ] + TRICK_EXPECT_EQ( str(test_so.obj.caa) , "[\"abcdefg\",\"hijklmn\",[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", test_suite , "2D array string assignment" ) + TRICK_EXPECT_EQ( str(test_so.obj.caa[1]) , "hijklmn", test_suite , "2D array item access" ) + TRICK_EXPECT_EQ( test_so.obj.caa[1][4] , 108, test_suite , "2D array single char access" ) + + TRICK_EXPECT_EQ( str(test_so.obj.cap) , """[NULL, NULL, NULL, NULL]""", test_suite , "2D array of ptr initial value" ) + + test_so.obj.cap[0] = "cap0" + test_so.obj.cap[1] = "cap1" + test_so.obj.cap[2] = "cap2" + test_so.obj.cap[3] = "cap3" + TRICK_EXPECT_EQ( str(test_so.obj.cap) , "[\"cap0\", \"cap1\", \"cap2\", \"cap3\"]", test_suite , "2D array of ptr single item assignment" ) + TRICK_EXPECT_EQ( str(test_so.obj.cap[0]) , "cap0", test_suite , "2D array of ptr single item assignment" ) + + TRICK_EXPECT_EQ( test_so.obj.cap[3][2] , 112 , test_suite , "2D array of ptr single item assignment" ) + + test_so.obj.cpp = trick.alloc_type( 4 , "char *") + TRICK_EXPECT_EQ( str(test_so.obj.cpp) , """[NULL, NULL, NULL, NULL]""", test_suite , "2D ptr of ptr initial value" ) + + test_so.obj.cpp[0] = "cpp_string_0" + test_so.obj.cpp[1] = "cpp_string_1" + test_so.obj.cpp[2] = "cpp_string_2" + test_so.obj.cpp[3] = "cpp_string_3" + TRICK_EXPECT_EQ( str(test_so.obj.cpp[2]) , "cpp_string_2", test_suite , "2D ptr of ptr single string access" ) + TRICK_EXPECT_EQ( test_so.obj.cpp[2][3] , 95 , test_suite , "2D ptr of ptr single character access" ) + + test_so.obj.cpp = None + TRICK_EXPECT_EQ( str(test_so.obj.cpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "unsigned char" + + test_so.obj.uc = 95 + TRICK_EXPECT_EQ( test_so.obj.uc , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "219444977") + + test_so.obj.uc += 1 + TRICK_EXPECT_EQ( test_so.obj.uc , 96 , test_suite , "increment" ) + + test_so.obj.uc = test_so.obj.uc + 1 + TRICK_EXPECT_EQ( test_so.obj.uc , 97 , test_suite , "increment" ) + + test_so.obj.uc = 1 + test_so.obj.uc + TRICK_EXPECT_EQ( test_so.obj.uc , 98 , test_suite , "increment" ) + + test_so.obj.uca = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.uca[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uca[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uca[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.uca = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.uca[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uca[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uca[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.ucp = trick.alloc_type( 6 , "unsigned char") + TRICK_EXPECT_EQ( test_so.obj.ucp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.ucp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.ucp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.ucp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.ucp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.ucp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.ucp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.ucp = None + TRICK_EXPECT_EQ( str(test_so.obj.ucp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.ucaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.ucaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.ucaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.ucaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.ucaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.ucaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.ucaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.ucaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.ucap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.ucap[0] = trick.alloc_type( 3 , "unsigned char") + test_so.obj.ucap[1] = trick.alloc_type( 4 , "unsigned char") + test_so.obj.ucap[2] = trick.alloc_type( 5 , "unsigned char") + test_so.obj.ucap[3] = trick.alloc_type( 6 , "unsigned char") + + TRICK_EXPECT_EQ( str(test_so.obj.ucap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.ucap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.ucap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.ucap[3][1] = 75 + test_so.obj.ucap[3][3] = trick.attach_units("--", int(test_so.obj.ucap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.ucap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.ucpp = trick.alloc_type( 4 , "unsigned char *") + TRICK_EXPECT_EQ( str(test_so.obj.ucpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.ucpp[0] = trick.alloc_type( 5 , "unsigned char") + TRICK_EXPECT_EQ( str(test_so.obj.ucpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.ucpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.ucpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.ucpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.ucpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.ucpp = None + TRICK_EXPECT_EQ( str(test_so.obj.ucpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "short" + + test_so.obj.s = 95 + TRICK_EXPECT_EQ( test_so.obj.s , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "2880907803") + + test_so.obj.s += 1 + TRICK_EXPECT_EQ( test_so.obj.s , 96 , test_suite , "increment" ) + + test_so.obj.s = test_so.obj.s + 1 + TRICK_EXPECT_EQ( test_so.obj.s , 97 , test_suite , "increment" ) + + test_so.obj.s = 1 + test_so.obj.s + TRICK_EXPECT_EQ( test_so.obj.s , 98 , test_suite , "increment" ) + + test_so.obj.sa = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.sa[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.sa[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.sa[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.sa = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.sa[0] , 30 , test_suite , "short 1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.sa[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.sa[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.sp = trick.alloc_type( 6 , "short") + TRICK_EXPECT_EQ( test_so.obj.sp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.sp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.sp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.sp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.sp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.sp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.sp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.sp = None + TRICK_EXPECT_EQ( str(test_so.obj.sp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.saa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.saa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.saa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.saa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.saa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.saa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.saa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.saa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.sap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.sap[0] = trick.alloc_type( 3 , "short") + test_so.obj.sap[1] = trick.alloc_type( 4 , "short") + test_so.obj.sap[2] = trick.alloc_type( 5 , "short") + test_so.obj.sap[3] = trick.alloc_type( 6 , "short") + + TRICK_EXPECT_EQ( str(test_so.obj.sap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.sap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.sap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.sap[3][1] = 75 + test_so.obj.sap[3][3] = trick.attach_units("--", int(test_so.obj.sap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.sap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.spp = trick.alloc_type( 4 , "short *") + TRICK_EXPECT_EQ( str(test_so.obj.spp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.spp[0] = trick.alloc_type( 5 , "short") + TRICK_EXPECT_EQ( str(test_so.obj.spp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.spp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.spp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.spp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.spp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.spp = None + TRICK_EXPECT_EQ( str(test_so.obj.spp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "unsigned short" + + test_so.obj.us = 95 + TRICK_EXPECT_EQ( test_so.obj.us , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "217750348") + + test_so.obj.us += 1 + TRICK_EXPECT_EQ( test_so.obj.us , 96 , test_suite , "increment" ) + + test_so.obj.us = test_so.obj.us + 1 + TRICK_EXPECT_EQ( test_so.obj.us , 97 , test_suite , "increment" ) + + test_so.obj.us = 1 + test_so.obj.us + TRICK_EXPECT_EQ( test_so.obj.us , 98 , test_suite , "increment" ) + + test_so.obj.usa = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.usa[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.usa[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.usa[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.usa = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.usa[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.usa[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.usa[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.usp = trick.alloc_type( 6 , "unsigned short") + TRICK_EXPECT_EQ( test_so.obj.usp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.usp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.usp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.usp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.usp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.usp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.usp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.usp = None + TRICK_EXPECT_EQ( str(test_so.obj.usp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.usaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.usaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.usaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.usaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.usaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.usaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.usaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.usaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.usap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.usap[0] = trick.alloc_type( 3 , "unsigned short") + test_so.obj.usap[1] = trick.alloc_type( 4 , "unsigned short") + test_so.obj.usap[2] = trick.alloc_type( 5 , "unsigned short") + test_so.obj.usap[3] = trick.alloc_type( 6 , "unsigned short") + + TRICK_EXPECT_EQ( str(test_so.obj.usap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.usap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.usap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.usap[3][1] = 75 + test_so.obj.usap[3][3] = trick.attach_units("--", int(test_so.obj.usap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.usap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.uspp = trick.alloc_type( 4 , "unsigned short *") + TRICK_EXPECT_EQ( str(test_so.obj.uspp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.uspp[0] = trick.alloc_type( 5 , "unsigned short") + TRICK_EXPECT_EQ( str(test_so.obj.uspp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.uspp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.uspp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.uspp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.uspp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.uspp = None + TRICK_EXPECT_EQ( str(test_so.obj.uspp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "enum" + + test_so.obj.e = trick.THIRD + TRICK_EXPECT_EQ( test_so.obj.e , trick.THIRD , test_suite , "scalar, integer value, no units" ) + trick.trick_test_add_parent( test_suite , "scalar, integer value, no units" , "3331066868") + + test_so.obj.ea = [ trick.THIRD , trick.SECOND , trick.FIRST ] + TRICK_EXPECT_EQ( test_so.obj.ea[0] , trick.THIRD , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ea[1] , trick.SECOND , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ea[2] , trick.FIRST , test_suite , "1D array, integer value, no units" ) + + test_so.obj.ea[1] = trick.THIRD + test_so.obj.ea[2] = trick.SECOND + TRICK_EXPECT_EQ( test_so.obj.ea[1] , trick.THIRD , test_suite , "1D array single value assignment" ) + TRICK_EXPECT_EQ( test_so.obj.ea[2] , trick.SECOND , test_suite , "1D array single value assignment" ) + + test_so.obj.ep = trick.alloc_type( 6 , "MY_ENUM") + TRICK_EXPECT_EQ( test_so.obj.ep[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.ep[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.ep) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.ep = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.ep) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.ep[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.ep) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.ep = None + TRICK_EXPECT_EQ( str(test_so.obj.ep) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.eaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.eaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.eaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.eaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.eaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.eaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.eaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.eaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.eap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.eap[0] = trick.alloc_type( 3 , "MY_ENUM") + test_so.obj.eap[1] = trick.alloc_type( 4 , "MY_ENUM") + test_so.obj.eap[2] = trick.alloc_type( 5 , "MY_ENUM") + test_so.obj.eap[3] = trick.alloc_type( 6 , "MY_ENUM") + + TRICK_EXPECT_EQ( str(test_so.obj.eap[0]) , "[0, 0, 0]", test_suite , "2D array of ptr, single row access" ) + + test_so.obj.eap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.eap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.eap[3][1] = 75 + test_so.obj.eap[3][3] = trick.attach_units("--", int(test_so.obj.eap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.eap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.epp = trick.alloc_type( 4 , "MY_ENUM *") + TRICK_EXPECT_EQ( str(test_so.obj.epp) , "[NULL, NULL, NULL, NULL]", + test_suite , "int 2D ptr of ptr, initial value" ) + + test_so.obj.epp[0] = trick.alloc_type( 5 , "MY_ENUM") + TRICK_EXPECT_EQ( str(test_so.obj.epp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.epp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.epp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.epp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.epp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.epp = None + TRICK_EXPECT_EQ( str(test_so.obj.epp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "int" + + test_so.obj.i = 95 + TRICK_EXPECT_EQ( test_so.obj.i , 95 , test_suite , "assignment" ) + #print "test_so.obj.i = " , test_so.obj.i + trick.trick_test_add_parent( test_suite , "assignment" , "3074788233") + + test_so.obj.i += 1 + TRICK_EXPECT_EQ( test_so.obj.i , 96 , test_suite , "increment" ) + + test_so.obj.i = test_so.obj.i + 1 + TRICK_EXPECT_EQ( test_so.obj.i , 97 , test_suite , "increment" ) + + test_so.obj.i = 1 + test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 98 , test_suite , "increment" ) + + test_so.obj.ia = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.ia[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ia[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ia[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.ia = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.ia[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ia[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ia[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.ia = trick.attach_units("--" , [60, 70]) + TRICK_EXPECT_EQ( test_so.obj.ia[0] , 60 , test_suite , "1D array, -- units" ) + TRICK_EXPECT_EQ( test_so.obj.ia[1] , 70 , test_suite , "1D array, -- units" ) + + test_so.obj.ip = trick.alloc_type( 6 , "int") + TRICK_EXPECT_EQ( test_so.obj.ip[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.ip[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.ip) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.ip = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.ip) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.ip[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.ip) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.ip = trick.attach_units("--" , [60, 70]) + TRICK_EXPECT_EQ( str(test_so.obj.ip) , "[60, 70]", test_suite , "1D ptr, assign list -- unit-ed values" ) + + test_so.obj.ip = None + TRICK_EXPECT_EQ( str(test_so.obj.ip) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.iaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.iaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.iaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.iaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.iaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.iaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.iaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.iaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.iap) , "[NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.iap[0] = trick.alloc_type( 3 , "int") + test_so.obj.iap[1] = trick.alloc_type( 4 , "int") + test_so.obj.iap[2] = trick.alloc_type( 5 , "int") + test_so.obj.iap[3] = trick.alloc_type( 6 , "int") + TRICK_EXPECT_EQ( str(test_so.obj.iap[0]) , "[0, 0, 0]", test_suite , "2D array of ptr, single row access" ) + + test_so.obj.iap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.iap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.iap[3][1] = 75 + test_so.obj.iap[3][3] = trick.attach_units("--", int(test_so.obj.iap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.iap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.ipp = trick.alloc_type( 4 , "int *") + TRICK_EXPECT_EQ( str(test_so.obj.ipp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.ipp[0] = trick.alloc_type( 5 , "int") + TRICK_EXPECT_EQ( str(test_so.obj.ipp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.ipp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.ipp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.ipp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.ipp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.ipp = None + TRICK_EXPECT_EQ( str(test_so.obj.ipp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "unsigned int" + + test_so.obj.ui = 95 + TRICK_EXPECT_EQ( test_so.obj.ui , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "1873736978") + + test_so.obj.ui += 1 + TRICK_EXPECT_EQ( test_so.obj.ui , 96 , test_suite , "increment" ) + + test_so.obj.ui = test_so.obj.ui + 1 + TRICK_EXPECT_EQ( test_so.obj.ui , 97 , test_suite , "increment" ) + + test_so.obj.ui = 1 + test_so.obj.ui + TRICK_EXPECT_EQ( test_so.obj.ui , 98 , test_suite , "increment" ) + + test_so.obj.uia = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.uia[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uia[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uia[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.uia = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.uia[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uia[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.uia[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.uip = trick.alloc_type( 6 , "unsigned int") + TRICK_EXPECT_EQ( test_so.obj.uip[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.uip[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.uip) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.uip = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.uip) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.uip[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.uip) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.uip = None + TRICK_EXPECT_EQ( str(test_so.obj.uip) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.uiaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.uiaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.uiaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.uiaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.uiaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.uiaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.uiaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.uiaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.uiap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.uiap[0] = trick.alloc_type( 3 , "unsigned int") + test_so.obj.uiap[1] = trick.alloc_type( 4 , "unsigned int") + test_so.obj.uiap[2] = trick.alloc_type( 5 , "unsigned int") + test_so.obj.uiap[3] = trick.alloc_type( 6 , "unsigned int") + + TRICK_EXPECT_EQ( str(test_so.obj.uiap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.uiap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.uiap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.uiap[3][1] = 75 + test_so.obj.uiap[3][3] = trick.attach_units("--", int(test_so.obj.uiap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.uiap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.uipp = trick.alloc_type( 4 , "unsigned int *") + TRICK_EXPECT_EQ( str(test_so.obj.uipp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.uipp[0] = trick.alloc_type( 5 , "unsigned int") + TRICK_EXPECT_EQ( str(test_so.obj.uipp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.uipp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.uipp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.uipp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.uipp[1]) , "[91, 92, 93]", test_suite , "unsigned int 2D ptr of ptr, row assignment" ) + + test_so.obj.uipp = None + TRICK_EXPECT_EQ( str(test_so.obj.uipp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "long" + + test_so.obj.l = 95 + TRICK_EXPECT_EQ( test_so.obj.l , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "3338288463") + + test_so.obj.l += 1 + TRICK_EXPECT_EQ( test_so.obj.l , 96 , test_suite , "increment" ) + + test_so.obj.l = test_so.obj.l + 1 + TRICK_EXPECT_EQ( test_so.obj.l , 97 , test_suite , "increment" ) + + test_so.obj.l = 1 + test_so.obj.l + TRICK_EXPECT_EQ( test_so.obj.l , 98 , test_suite , "increment" ) + + test_so.obj.la = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.la[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.la[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.la[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.la = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.la[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.la[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.la[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.lp = trick.alloc_type( 6 , "long") + TRICK_EXPECT_EQ( test_so.obj.lp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.lp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.lp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.lp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.lp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.lp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.lp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.lp = None + TRICK_EXPECT_EQ( str(test_so.obj.lp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.laa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.laa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.laa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.laa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.laa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.laa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.laa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.laa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.lap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.lap[0] = trick.alloc_type( 3 , "long") + test_so.obj.lap[1] = trick.alloc_type( 4 , "long") + test_so.obj.lap[2] = trick.alloc_type( 5 , "long") + test_so.obj.lap[3] = trick.alloc_type( 6 , "long") + + TRICK_EXPECT_EQ( str(test_so.obj.lap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.lap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.lap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.lap[3][1] = 75 + test_so.obj.lap[3][3] = trick.attach_units("--", int(test_so.obj.lap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.lap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.lpp = trick.alloc_type( 4 , "long *") + TRICK_EXPECT_EQ( str(test_so.obj.lpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.lpp[0] = trick.alloc_type( 5 , "long") + TRICK_EXPECT_EQ( str(test_so.obj.lpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.lpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.lpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.lpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.lpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.lpp = None + TRICK_EXPECT_EQ( str(test_so.obj.lpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "unsinged long" + + test_so.obj.ul = 95 + TRICK_EXPECT_EQ( test_so.obj.ul , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "2844151852") + + test_so.obj.ul += 1 + TRICK_EXPECT_EQ( test_so.obj.ul , 96 , test_suite , "increment" ) + + test_so.obj.ul = test_so.obj.ul + 1 + TRICK_EXPECT_EQ( test_so.obj.ul , 97 , test_suite , "increment" ) + + test_so.obj.ul = 1 + test_so.obj.ul + TRICK_EXPECT_EQ( test_so.obj.ul , 98 , test_suite , "increment" ) + + test_so.obj.ula = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.ula[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ula[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ula[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.ula = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.ula[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ula[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ula[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.ulp = trick.alloc_type( 6 , "unsigned long") + TRICK_EXPECT_EQ( test_so.obj.ulp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.ulp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.ulp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.ulp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.ulp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.ulp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.ulp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.ulp = None + TRICK_EXPECT_EQ( str(test_so.obj.ulp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.ulaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.ulaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.ulaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.ulaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.ulaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.ulaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.ulaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.ulaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.ulap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.ulap[0] = trick.alloc_type( 3 , "unsigned long") + test_so.obj.ulap[1] = trick.alloc_type( 4 , "unsigned long") + test_so.obj.ulap[2] = trick.alloc_type( 5 , "unsigned long") + test_so.obj.ulap[3] = trick.alloc_type( 6 , "unsigned long") + + TRICK_EXPECT_EQ( str(test_so.obj.ulap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.ulap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.ulap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.ulap[3][1] = 75 + test_so.obj.ulap[3][3] = trick.attach_units("--", int(test_so.obj.ulap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.ulap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.ulpp = trick.alloc_type( 4 , "unsigned long *") + TRICK_EXPECT_EQ( str(test_so.obj.ulpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.ulpp[0] = trick.alloc_type( 5 , "unsigned long") + TRICK_EXPECT_EQ( str(test_so.obj.ulpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.ulpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.ulpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.ulpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.ulpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.ulpp = None + TRICK_EXPECT_EQ( str(test_so.obj.ulpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "long long" + + test_so.obj.ll = 95 + TRICK_EXPECT_EQ( test_so.obj.ll , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "2165977787") + + test_so.obj.ll += 1 + TRICK_EXPECT_EQ( test_so.obj.ll , 96 , test_suite , "increment" ) + + test_so.obj.ll = test_so.obj.ll + 1 + TRICK_EXPECT_EQ( test_so.obj.ll , 97 , test_suite , "increment" ) + + test_so.obj.ll = 1 + test_so.obj.ll + TRICK_EXPECT_EQ( test_so.obj.ll , 98 , test_suite , "increment" ) + + test_so.obj.lla = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.lla[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.lla[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.lla[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.lla = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.lla[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.lla[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.lla[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.llp = trick.alloc_type( 6 , "long long") + TRICK_EXPECT_EQ( test_so.obj.llp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.llp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.llp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.llp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.llp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.llp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.llp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.llp = None + TRICK_EXPECT_EQ( str(test_so.obj.llp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.llaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.llaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.llaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.llaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.llaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.llaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.llaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.llaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.llap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.llap[0] = trick.alloc_type( 3 , "long long") + test_so.obj.llap[1] = trick.alloc_type( 4 , "long long") + test_so.obj.llap[2] = trick.alloc_type( 5 , "long long") + test_so.obj.llap[3] = trick.alloc_type( 6 , "long long") + + TRICK_EXPECT_EQ( str(test_so.obj.llap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.llap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.llap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.llap[3][1] = 75 + test_so.obj.llap[3][3] = trick.attach_units("--", int(test_so.obj.llap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.llap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.llpp = trick.alloc_type( 4 , "long long *") + TRICK_EXPECT_EQ( str(test_so.obj.llpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.llpp[0] = trick.alloc_type( 5 , "long long") + TRICK_EXPECT_EQ( str(test_so.obj.llpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.llpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.llpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.llpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.llpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.llpp = None + TRICK_EXPECT_EQ( str(test_so.obj.llpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "unsigned long long" + + test_so.obj.ull = 95 + TRICK_EXPECT_EQ( test_so.obj.ull , 95 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "3783821020") + + test_so.obj.ull += 1 + TRICK_EXPECT_EQ( test_so.obj.ull , 96 , test_suite , "increment" ) + + test_so.obj.ull = test_so.obj.ull + 1 + TRICK_EXPECT_EQ( test_so.obj.ull , 97 , test_suite , "increment" ) + + test_so.obj.ull = 1 + test_so.obj.ull + TRICK_EXPECT_EQ( test_so.obj.ull , 98 , test_suite , "increment" ) + + test_so.obj.ulla = [ 20 , 21 , 22 ] + TRICK_EXPECT_EQ( test_so.obj.ulla[0] , 20 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ulla[1] , 21 , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ulla[2] , 22 , test_suite , "1D array, integer value, no units" ) + + test_so.obj.ulla = [ 30.1 , 31.1 , 32.1 ] + TRICK_EXPECT_EQ( test_so.obj.ulla[0] , 30 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ulla[1] , 31 , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ulla[2] , 32 , test_suite , "1D array, float value, no units" ) + + test_so.obj.ullp = trick.alloc_type( 6 , "unsigned long long") + TRICK_EXPECT_EQ( test_so.obj.ullp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.ullp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.ullp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) + + test_so.obj.ullp = [ 30 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.ullp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.ullp[2] = 62 + TRICK_EXPECT_EQ( str(test_so.obj.ullp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.ullp = None + TRICK_EXPECT_EQ( str(test_so.obj.ullp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.ullaa = [[ 40 , 41 , 42] , [43, 44, 45]] + TRICK_EXPECT_EQ( str(test_so.obj.ullaa) , "[[40, 41, 42],[43, 44, 45]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.ullaa[1] = [ 50 , 51 , 52] + TRICK_EXPECT_EQ( str(test_so.obj.ullaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.ullaa[1] = [ 50.1 , 51.2 , 52.3 ] + TRICK_EXPECT_EQ( str(test_so.obj.ullaa) , "[[40, 41, 42],[50, 51, 52]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.ullaa[1][1] = 60 + TRICK_EXPECT_EQ( str(test_so.obj.ullaa) , "[[40, 41, 42],[50, 60, 52]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.ullap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.ullap[0] = trick.alloc_type( 3 , "unsigned long long") + test_so.obj.ullap[1] = trick.alloc_type( 4 , "unsigned long long") + test_so.obj.ullap[2] = trick.alloc_type( 5 , "unsigned long long") + test_so.obj.ullap[3] = trick.alloc_type( 6 , "unsigned long long") + + TRICK_EXPECT_EQ( str(test_so.obj.ullap[0]) , "[0, 0, 0]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.ullap[3] = [ 60 , 61 , 62, 63 ] + TRICK_EXPECT_EQ( str(test_so.obj.ullap[3]) , "[60, 61, 62, 63]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.ullap[3][1] = 75 + test_so.obj.ullap[3][3] = trick.attach_units("--", int(test_so.obj.ullap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.ullap[3]) , "[60, 75, 62, 64]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.ullpp = trick.alloc_type( 4 , "unsigned long long *") + TRICK_EXPECT_EQ( str(test_so.obj.ullpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.ullpp[0] = trick.alloc_type( 5 , "unsigned long long") + TRICK_EXPECT_EQ( str(test_so.obj.ullpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.ullpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.ullpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.ullpp[1] = [ 91 , 92 , 93 ] + TRICK_EXPECT_EQ( str(test_so.obj.ullpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.ullpp = None + TRICK_EXPECT_EQ( str(test_so.obj.ullpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "bool" + + test_so.obj.b = True + TRICK_EXPECT_EQ( test_so.obj.b , True , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "4134211307") + + test_so.obj.b += 1 + TRICK_EXPECT_EQ( test_so.obj.b , True , test_suite , "increment" ) + + test_so.obj.b = test_so.obj.b + 1 + TRICK_EXPECT_EQ( test_so.obj.b , True , test_suite , "increment" ) + + test_so.obj.ull = 1 + test_so.obj.ull + TRICK_EXPECT_EQ( test_so.obj.b , True , test_suite , "increment" ) + + test_so.obj.ba = [ False , True , True ] + TRICK_EXPECT_EQ( test_so.obj.ba[0] , False , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ba[1] , True , test_suite , "1D array, integer value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ba[2] , True , test_suite , "1D array, integer value, no units" ) + + test_so.obj.ba = [ 2.2 , 1.1 , 0 ] + TRICK_EXPECT_EQ( test_so.obj.ba[0] , True , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ba[1] , True , test_suite , "1D array, float value, no units" ) + TRICK_EXPECT_EQ( test_so.obj.ba[2] , False , test_suite , "1D array, float value, no units" ) + + test_so.obj.bp = trick.alloc_type( 6 , "bool" ) + TRICK_EXPECT_EQ( test_so.obj.bp[0] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( test_so.obj.bp[5] , 0 , test_suite , "1D ptr, allocation" ) + TRICK_EXPECT_EQ( str(test_so.obj.bp) , "[False, False, False, False, False, False]", test_suite , "1D ptr, allocation" ) + + test_so.obj.bp = [ 0 , 31 , 32 , 33 ] + TRICK_EXPECT_EQ( str(test_so.obj.bp) , "[False, True, True, True]", test_suite , "1D ptr, list assign, no units" ) + + test_so.obj.bp[2] = 0 + TRICK_EXPECT_EQ( str(test_so.obj.bp) , "[False, True, False, True]", test_suite , "1D ptr, partial assign, no units" ) + + test_so.obj.bp = None + TRICK_EXPECT_EQ( str(test_so.obj.bp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) + + test_so.obj.baa = [[ 0 , 1 , 2] , [3, 4, 0]] + TRICK_EXPECT_EQ( str(test_so.obj.baa) , "[[False, True, True],[True, True, False]]", + test_suite , "2D array, full assign, no units" ) + + test_so.obj.baa[1] = [ False , False , True] + TRICK_EXPECT_EQ( str(test_so.obj.baa) , "[[False, True, True],[False, False, True]]", + test_suite , "2D array, partial assign, no units" ) + + test_so.obj.baa[1][1] = True + TRICK_EXPECT_EQ( str(test_so.obj.baa) , "[[False, True, True],[False, True, True]]", + test_suite , "2D array, single assign, no units" ) + + TRICK_EXPECT_EQ( str(test_so.obj.bap) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D array of ptr, initial value" ) + + test_so.obj.bap[0] = trick.alloc_type( 3 , "bool") + test_so.obj.bap[1] = trick.alloc_type( 4 , "bool") + test_so.obj.bap[2] = trick.alloc_type( 5 , "bool") + test_so.obj.bap[3] = trick.alloc_type( 6 , "bool") + + TRICK_EXPECT_EQ( str(test_so.obj.bap[0]) , "[False, False, False]", + test_suite , "2D array of ptr, single row access" ) + + test_so.obj.bap[3] = [ True , False , True, False ] + TRICK_EXPECT_EQ( str(test_so.obj.bap[3]) , "[True, False, True, False]", + test_suite , "2D array of ptr, single row realloc and assignment" ) + + test_so.obj.bap[3][1] = 75 + test_so.obj.bap[3][3] = trick.attach_units("--", int(test_so.obj.bap[3][3]) + 1) + + TRICK_EXPECT_EQ( str(test_so.obj.bap[3]) , "[True, True, True, True]", + test_suite , "2D array of ptr, single item assignment with unit conversion" ) + + test_so.obj.bpp = trick.alloc_type( 4 , "bool *") + TRICK_EXPECT_EQ( str(test_so.obj.bpp) , "[NULL, NULL, NULL, NULL]", + test_suite , "2D ptr of ptr, initial value" ) + + test_so.obj.bpp[0] = trick.alloc_type( 5 , "bool") + TRICK_EXPECT_EQ( str(test_so.obj.bpp[0]) , "[False, False, False, False, False]", test_suite , "2D ptr of ptr, allocate 1 row" ) + + test_so.obj.bpp[0][1] = 85 + TRICK_EXPECT_EQ( str(test_so.obj.bpp[0]) , "[False, True, False, False, False]", test_suite , "2D ptr of ptr, assign 1 value" ) + + test_so.obj.bpp[1] = [ True , False , True ] + TRICK_EXPECT_EQ( str(test_so.obj.bpp[1]) , "[True, False, True]", test_suite , "2D ptr of ptr, row assignment" ) + + test_so.obj.bpp = None + TRICK_EXPECT_EQ( str(test_so.obj.bpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) + +###################################################################################################################### + + test_suite = "structure" + + test_so.obj.cana[0].ii = 250 + test_so.obj.cana[0].jj = 350 + test_so.obj.cana[1].ii = 260 + test_so.obj.cana[1].jj = 360 + TRICK_EXPECT_EQ( test_so.obj.cana[0].ii , 250 , test_suite , "1D array access" ) + TRICK_EXPECT_EQ( test_so.obj.cana[0].jj , 350 , test_suite , "1D array access" ) + TRICK_EXPECT_EQ( test_so.obj.cana[1].ii , 260 , test_suite , "1D array access" ) + TRICK_EXPECT_EQ( test_so.obj.cana[1].jj , 360 , test_suite , "1D array access" ) + trick.trick_test_add_parent( test_suite , "1D array access" , "2797105872") + + test_so.obj.can.ii = 150 + test_so.obj.can.jj = 160 + test_so.obj.can2 = test_so.obj.can + TRICK_EXPECT_EQ( test_so.obj.can2.ii , 150 , test_suite , "copy" ) + TRICK_EXPECT_EQ( test_so.obj.can2.jj , 160 , test_suite , "copy" ) + + #test_so.obj.cana[3] = test_so.obj.can + + test_so.obj.canp = test_so.obj.can + TRICK_EXPECT_EQ( test_so.obj.canp.ii , 150 , test_suite , "pointer assignment" ) + TRICK_EXPECT_EQ( test_so.obj.canp.jj , 160 , test_suite , "pointer assignment" ) + + test_so.obj.canp = test_so.obj.cana[1] + TRICK_EXPECT_EQ( test_so.obj.canp.ii , 260 , test_suite , "pointer to array element assignment" ) + TRICK_EXPECT_EQ( test_so.obj.canp.jj , 360 , test_suite , "pointer to array element assignment" ) + + test_so.obj.canp = trick.alloc_type( 2 , "CanCopy" ) + test_so.obj.canp[0].ii = 400 + test_so.obj.canp[0].jj = 500 + test_so.obj.canp[1].ii = 600 + test_so.obj.canp[1].jj = 700 + TRICK_EXPECT_EQ( test_so.obj.canp[0].ii , 400 , test_suite , "pointer to array element assignment" ) + TRICK_EXPECT_EQ( test_so.obj.canp[0].jj , 500 , test_suite , "pointer to array element assignment" ) + TRICK_EXPECT_EQ( test_so.obj.canp[1].ii , 600 , test_suite , "pointer to array element assignment" ) + TRICK_EXPECT_EQ( test_so.obj.canp[1].jj , 700 , test_suite , "pointer to array element assignment" ) + #print test_so.obj.canp[0] + #print test_so.obj.canp[1] + + test_so.obj.canp = None + TRICK_EXPECT_EQ( str(test_so.obj.canp) , "None", test_suite , "1D ptr None (NULL) assignment" ) + + # silently ignored! need to figure out how to flag this + #test_so.obj.cannot = test_so.obj.cannot2 + +###################################################################################################################### + + test_suite = "string" + + test_so.obj.str = "hello" + TRICK_EXPECT_EQ( test_so.obj.str , "hello" , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "165635378") + + #TODO: make a std::string typemap to allow assignment of string from char * + #test_so.obj.str = test_so.obj.cap[1] + #TRICK_EXPECT_EQ( test_so.obj.str , "cap1" , "IPtest" , "string assignment from char *" ) + #print "test_so.obj.str = " , test_so.obj.str + +###################################################################################################################### + + test_suite = "bitfield" + + test_so.obj.bit_0 = 7 + TRICK_EXPECT_EQ( test_so.obj.bit_0 , 7 , test_suite , "assignment" ) + trick.trick_test_add_parent( test_suite , "assignment" , "1649805110") + + test_so.obj.bit_1 = 17 + TRICK_EXPECT_EQ( test_so.obj.bit_1 , -15 , test_suite , "assignment with overflow" ) + + test_so.obj.boolbit_0 = True + TRICK_EXPECT_EQ( test_so.obj.boolbit_0 , True , test_suite , "bool assignment" ) + + test_so.obj.boolbit_1 = 2 + TRICK_EXPECT_EQ( test_so.obj.boolbit_1 , True , test_suite , "bool assignment with overflow" ) + +###################################################################################################################### + + test_suite = "union" + + test_so.obj.ut.i = 20 + TRICK_EXPECT_EQ( str(test_so.obj.ut.i) , "20", test_suite , "test 1" ) + trick.trick_test_add_parent( test_suite , "test 1" , "3095148896") + + test_so.obj.ut2.i = 30 + TRICK_EXPECT_EQ( str(test_so.obj.ut2.i) , "30", test_suite , "test 2" ) + trick.trick_test_add_parent( test_suite , "test 2" , "3095148896") + +###################################################################################################################### + + # swig_int from swig_double + test_suite = "swig_int" + + test_so.obj.dlbm = 50 + test_so.obj.ilbm = test_so.obj.dlbm + TRICK_EXPECT_EQ( test_so.obj.ilbm , 50, test_suite , "assignment from swig_double" ) + trick.trick_test_add_parent( test_suite , "assignment from swig_double" , "2901141151") + + # addition + + test_so.obj.ilbm = 50 + test_so.obj.ikg = test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 22, test_suite , "units conversion" ) + + test_so.obj.ikg = test_so.obj.ilbm + 20 + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "addition with integer" ) + + test_so.obj.ikg = test_so.obj.ilbm + 20.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 32, test_suite , "addition with float" ) + + test_so.obj.ikg = test_so.obj.ilbm + test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 45, test_suite , "addition with swig_int" ) + + test_so.obj.ikg = 50 + test_so.obj.ikg = test_so.obj.ilbm + test_so.obj.ikg + TRICK_EXPECT_EQ( test_so.obj.ikg , 72, test_suite , "addition with swig_int and unit conversion" ) + + test_so.obj.dlbm = 10 + test_so.obj.ikg = test_so.obj.ilbm + test_so.obj.dlbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 27, test_suite , "addition with swig_double" ) + + test_so.obj.dkg = 10 + test_so.obj.ikg = test_so.obj.ilbm + test_so.obj.dkg + TRICK_EXPECT_EQ( test_so.obj.ikg , 32, test_suite , "addition with swig_double and unit conversion" ) + + # subtraction + + test_so.obj.ikg = test_so.obj.ilbm - 20 + TRICK_EXPECT_EQ( test_so.obj.ikg , 13, test_suite , "subtraction with integer" ) + + test_so.obj.ikg = test_so.obj.ilbm - 20.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 13, test_suite , "subtraction with float" ) + + test_so.obj.ikg = test_so.obj.ilbm - test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 0, test_suite , "subtraction with swig_int" ) + + test_so.obj.ikg = 10 + test_so.obj.ikg = test_so.obj.ilbm - test_so.obj.ikg + TRICK_EXPECT_EQ( test_so.obj.ikg , 12, test_suite , "subtraction with swig_int and unit conversion" ) + + test_so.obj.dlbm = 10 + test_so.obj.ikg = test_so.obj.ilbm - test_so.obj.dlbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 18, test_suite , "subtraction with swig_double" ) + + test_so.obj.dkg = 10 + test_so.obj.ikg = test_so.obj.ilbm - test_so.obj.dkg + TRICK_EXPECT_EQ( test_so.obj.ikg , 12, test_suite , "subtraction with swig_double and unit conversion" ) + + # multiplication + + test_so.obj.ilbm = 50 + test_so.obj.ikg = test_so.obj.ilbm * 3 + TRICK_EXPECT_EQ( test_so.obj.ikg , 68, test_suite , "multiplication with int" ) + + test_so.obj.ikg = test_so.obj.ilbm * 2.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 65, test_suite , "multiplication with float" ) + + test_so.obj.ilbm = 50 + test_so.obj.i = 2 + test_so.obj.ikg = test_so.obj.ilbm * test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 45, test_suite , "multiplication with unitless swig_int" ) + + test_so.obj.ilbm = 50 + test_so.obj.dno_units = 2.2 + test_so.obj.ikg = test_so.obj.ilbm * test_so.obj.dno_units + TRICK_EXPECT_EQ( test_so.obj.ikg , 49, test_suite , "multiplication with unitless swig_double" ) + + # division + + test_so.obj.ilbm = 50 + test_so.obj.ikg = test_so.obj.ilbm / 3 + TRICK_EXPECT_EQ( test_so.obj.ikg , 7, test_suite , "division with int" ) + + test_so.obj.ikg = test_so.obj.ilbm / 2.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 7, test_suite , "division with float" ) + + # floor division + + test_so.obj.ikg = 29 + test_so.obj.ikg = test_so.obj.ikg // 4 + TRICK_EXPECT_EQ( test_so.obj.ikg , 7, test_suite , "floor division with int" ) + + test_so.obj.ikg = 29 + test_so.obj.ikg = test_so.obj.ikg // 4.5 + TRICK_EXPECT_EQ( test_so.obj.ikg , 6, test_suite , "floor division with int" ) + + # mod + + test_so.obj.ikg = 29 + test_so.obj.ikg = test_so.obj.ikg % 4 + TRICK_EXPECT_EQ( test_so.obj.ikg , 1, test_suite , "mod with int" ) + + test_so.obj.ikg = 29 + test_so.obj.ikg = test_so.obj.ikg % 4.5 + TRICK_EXPECT_EQ( test_so.obj.ikg , 2, test_suite , "mod with float" ) + + test_so.obj.ilbm = 50 + test_so.obj.i = 13 + test_so.obj.ikg = test_so.obj.ilbm % test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "mod with unitless swig_int" ) + + test_so.obj.ilbm = 50 + test_so.obj.dno_units = 13.5 + test_so.obj.ikg = test_so.obj.ilbm % test_so.obj.dno_units + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "mod with unitless swig_double" ) + + # pow + + test_so.obj.i = 5 + test_so.obj.i = pow(test_so.obj.i , 4) + TRICK_EXPECT_EQ( test_so.obj.i , 625, test_suite , "pow with int" ) + + test_so.obj.i = 5 + test_so.obj.i = pow(test_so.obj.i , 2.5) + TRICK_EXPECT_EQ( test_so.obj.i , 55, test_suite , "pow with float" ) + + test_so.obj.i = 5 + test_so.obj.i = pow(test_so.obj.i , test_so.obj.i) + TRICK_EXPECT_EQ( test_so.obj.i , 3125, test_suite , "pow with unitless swig_int" ) + + test_so.obj.i = 5 + test_so.obj.dno_units = 5.0 + test_so.obj.i = pow(test_so.obj.i , test_so.obj.dno_units) + TRICK_EXPECT_EQ( test_so.obj.i , 3125, test_suite , "pow with unitless swig_double" ) + + # left shift + + test_so.obj.ikg = 16 + test_so.obj.ikg = test_so.obj.ikg << 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 64, test_suite , "left shift with int" ) + + test_so.obj.ikg = 16 + test_so.obj.i = 1 + test_so.obj.ikg = test_so.obj.ikg << test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 32, test_suite , "left shift with unitless swig_int" ) + + # right shift + + test_so.obj.ikg = 16 + test_so.obj.ikg = test_so.obj.ikg >> 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "right shift with int" ) + + test_so.obj.ikg = 16 + test_so.obj.i = 1 + test_so.obj.ikg = test_so.obj.ikg >> test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 8, test_suite , "left shift with unitless swig_int" ) + + # and + + test_so.obj.ikg = 12 + test_so.obj.ikg = test_so.obj.ikg & 5 + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "and with int" ) + + test_so.obj.ikg = 12 + test_so.obj.i = 5 + test_so.obj.ikg = test_so.obj.ikg & test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "and with unitless swig_int" ) + + # xor + + test_so.obj.ikg = 29 + test_so.obj.ikg = test_so.obj.ikg ^ 7 + TRICK_EXPECT_EQ( test_so.obj.ikg , 26, test_suite , "xor with int" ) + + test_so.obj.ikg = 29 + test_so.obj.i = 7 + test_so.obj.ikg = test_so.obj.ikg ^ test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 26, test_suite , "xor with unitless swig_int" ) + + # or + + test_so.obj.ikg = 29 + test_so.obj.ikg = test_so.obj.ikg | 7 + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "or with int" ) + + test_so.obj.ikg = 29 + test_so.obj.i = 7 + test_so.obj.ikg = test_so.obj.ikg | test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "or with unitless swig_int" ) + + # reverse addition + + test_so.obj.ikg = 20 + test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "reverse addition with integer" ) + + test_so.obj.ikg = 20.9 + test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 32, test_suite , "reverse addition with float" ) + + # reverse subtraction + + test_so.obj.ikg = 120 - test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "reverse subtraction with integer" ) + + test_so.obj.ikg = 120.9 - test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 32, test_suite , "reverse subtraction with float" ) + + # reverse multiplication + + test_so.obj.ilbm = 50 + test_so.obj.ikg = 3 * test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 68, test_suite , "reverse multiplication with int" ) + + test_so.obj.ikg = 2.9 * test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 65, test_suite , "reverse multiplication with float" ) + + # reverse division + + test_so.obj.i = 5 + test_so.obj.i = 62 / test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 12, test_suite , "reverse division with int" ) + + test_so.obj.i = 5 + test_so.obj.i = 62.5 / test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 12, test_suite , "reverse division with float" ) + + # reverse mod + + test_so.obj.i = 5 + test_so.obj.i = 62 % test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 2, test_suite , "reverse mod with int" ) + + test_so.obj.i = 5 + test_so.obj.i = 62.5 % test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 2, test_suite , "reverse mod with float" ) + + # pow + + test_so.obj.i = 4 + test_so.obj.i = pow(4 , test_so.obj.i) + TRICK_EXPECT_EQ( test_so.obj.i , 256, test_suite , "reverse pow with int" ) + + test_so.obj.i = 5 + test_so.obj.i = pow(2.1 , test_so.obj.i) + TRICK_EXPECT_EQ( test_so.obj.i , 40, test_suite , "reverse pow with float" ) + + # reverse lshift + test_so.obj.i = 3 + test_so.obj.i = 8 << test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 64, test_suite , "reverse lshift with int" ) + + # reverse rshift + test_so.obj.i = 2 + test_so.obj.i = 8 >> test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 2, test_suite , "reverse rshift with int" ) + + # reverse and + + test_so.obj.ikg = 12 + test_so.obj.ikg = 5 & test_so.obj.ikg + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "reverse and with int" ) + + # reverse xor + + test_so.obj.ikg = 29 + test_so.obj.ikg = 7 ^ test_so.obj.ikg + TRICK_EXPECT_EQ( test_so.obj.ikg , 26, test_suite , "reverse xor with int" ) + + # reverse or + + test_so.obj.ikg = 29 + test_so.obj.ikg = 7 | test_so.obj.ikg + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "reverse or with int" ) + + # in-place addition + + test_so.obj.ikg = 10 + test_so.obj.ikg += 20 + TRICK_EXPECT_EQ( test_so.obj.ikg , 30, test_suite , "in-place addition with integer" ) + + test_so.obj.ikg += 20.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 51, test_suite , "in-place addition with float" ) + + test_so.obj.ilbm = 10 + test_so.obj.ikg += test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 55, test_suite , "in-place addition with swig_int" ) + + test_so.obj.dkg = 10 + test_so.obj.ikg += test_so.obj.dkg + TRICK_EXPECT_EQ( test_so.obj.ikg , 65, test_suite , "in-place addition with swig_double and unit conversion" ) + + # in-place subtraction + + test_so.obj.ikg = 10 + test_so.obj.ikg -= 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 8, test_suite , "in-place subtraction with integer" ) + + test_so.obj.ikg -= 2.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 5, test_suite , "in-place subtraction with float" ) + + test_so.obj.ilbm = 10 + test_so.obj.ikg -= test_so.obj.ilbm + TRICK_EXPECT_EQ( test_so.obj.ikg , 1, test_suite , "in-place subtraction with swig_int" ) + + test_so.obj.dkg = 1 + test_so.obj.ikg -= test_so.obj.dkg + TRICK_EXPECT_EQ( test_so.obj.ikg , 0, test_suite , "in-place subtraction with swig_double and unit conversion" ) + + # in-place multiplication + + test_so.obj.ikg = 10 + test_so.obj.ikg *= 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 20, test_suite , "in-place multiplication with integer" ) + + test_so.obj.ikg *= 3.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 78, test_suite , "in-place multiplication with float" ) + + test_so.obj.ikg = 10 + test_so.obj.i = 2 + test_so.obj.ikg *= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 20, test_suite , "in-place multiplication with unitless swig_int" ) + + test_so.obj.ikg = 10 + test_so.obj.dno_units = 3.9 + test_so.obj.ikg *= test_so.obj.dno_units + TRICK_EXPECT_EQ( test_so.obj.ikg , 39, test_suite , "in-place multiplication with unitless swig_double" ) + # in-place division + + test_so.obj.ikg = 10 + test_so.obj.ikg /= 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 5, test_suite , "in-place division with integer" ) + + test_so.obj.ikg = 10 + test_so.obj.ikg /= 3.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 3, test_suite , "in-place division with float" ) + + test_so.obj.ikg = 10 + test_so.obj.i = 2 + test_so.obj.ikg /= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 5, test_suite , "in-place division with unitless swig_int" ) + + # in-place mod + + test_so.obj.ikg = 10 + test_so.obj.ikg %= 3 + TRICK_EXPECT_EQ( test_so.obj.ikg , 1, test_suite , "in-place mod with integer" ) + + test_so.obj.ikg = 10 + test_so.obj.ikg %= 3.9 + TRICK_EXPECT_EQ( test_so.obj.ikg , 2, test_suite , "in-place mod with float" ) + + test_so.obj.ikg = 10 + test_so.obj.i = 3 + test_so.obj.ikg %= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 1, test_suite , "in-place mod with unitless swig_int" ) + + # in-place pow + + test_so.obj.i = 5 + test_so.obj.i **= 4 + TRICK_EXPECT_EQ( test_so.obj.i , 625, test_suite , "in-place pow with int" ) + + test_so.obj.i = 5 + test_so.obj.i **= 2.5 + TRICK_EXPECT_EQ( test_so.obj.i , 56, test_suite , "in-place pow with float" ) + + test_so.obj.i = 5 + test_so.obj.i **= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.i , 3125, test_suite , "in-place pow with unitless swig_int" ) + + test_so.obj.i = 5 + test_so.obj.dno_units = 5.0 + test_so.obj.i **= test_so.obj.dno_units + TRICK_EXPECT_EQ( test_so.obj.i , 3125, test_suite , "in-place pow with unitless swig_double" ) + + # in-place left shift + + test_so.obj.ikg = 16 + test_so.obj.ikg <<= 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 64, test_suite , "left shift with int" ) + + test_so.obj.i = 16 + test_so.obj.ia[0] = 1 + test_so.obj.i <<= test_so.obj.ia[0] + TRICK_EXPECT_EQ( test_so.obj.i , 32, test_suite , "left shift with unitless swig_int" ) + + # in-place right shift + + test_so.obj.ikg = 16 + test_so.obj.ikg >>= 2 + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "right shift with int" ) + + test_so.obj.ikg = 16 + test_so.obj.i = 1 + test_so.obj.ikg >>= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 8, test_suite , "left shift with unitless swig_int" ) + + # in-place and + + test_so.obj.ikg = 12 + test_so.obj.ikg &= 5 + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "and with int" ) + + test_so.obj.ikg = 12 + test_so.obj.i = 5 + test_so.obj.ikg &= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 4, test_suite , "and with unitless swig_int" ) + + # in-place xor + + test_so.obj.ikg = 29 + test_so.obj.ikg ^= 7 + TRICK_EXPECT_EQ( test_so.obj.ikg , 26, test_suite , "xor with int" ) + + test_so.obj.ikg = 29 + test_so.obj.i = 7 + test_so.obj.ikg ^= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 26, test_suite , "xor with unitless swig_int" ) + + # in-place or + + test_so.obj.ikg = 29 + test_so.obj.ikg |= 7 + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "or with int" ) + + test_so.obj.ikg = 29 + test_so.obj.i = 7 + test_so.obj.ikg |= test_so.obj.i + TRICK_EXPECT_EQ( test_so.obj.ikg , 31, test_suite , "or with unitless swig_int" ) + + # less than + + test_so.obj.ikg = 20 + test_so.obj.ilbm = 20 + + test = test_so.obj.ikg < 21 + TRICK_EXPECT_EQ( test , True, test_suite , "lt with integer" ) + + test = test_so.obj.ikg < 20.5 + TRICK_EXPECT_EQ( test , True, test_suite , "lt with float" ) + + test = test_so.obj.ikg < test_so.obj.ilbm + TRICK_EXPECT_EQ( test , False, test_suite , "lt with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.ikg < test_so.obj.dkg + TRICK_EXPECT_EQ( test , True, test_suite , "lt with swig_double and unit conversion" ) + + # less than or equal + + test_so.obj.ikg = 20 + test_so.obj.ilbm = 20 + + test = test_so.obj.ikg <= 21 + TRICK_EXPECT_EQ( test , True, test_suite , "le with integer" ) + + test = test_so.obj.ikg <= 20.5 + TRICK_EXPECT_EQ( test , True, test_suite , "le with float" ) + + test = test_so.obj.ikg <= test_so.obj.ilbm + TRICK_EXPECT_EQ( test , False, test_suite , "le with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.ikg <= test_so.obj.dkg + TRICK_EXPECT_EQ( test , True, test_suite , "le with swig_double and unit conversion" ) + + # equal + + test = test_so.obj.ikg == 21 + TRICK_EXPECT_EQ( test , False, test_suite , "eq with integer" ) + + test = test_so.obj.ikg == 20.5 + TRICK_EXPECT_EQ( test , False, test_suite , "eq with float" ) + + test = test_so.obj.ikg == test_so.obj.ilbm + TRICK_EXPECT_EQ( test , False, test_suite , "eq with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.ikg == test_so.obj.dkg + TRICK_EXPECT_EQ( test , False, test_suite , "eq with swig_double and unit conversion" ) + + # not equal + + test = test_so.obj.ikg != 21 + TRICK_EXPECT_EQ( test , True, test_suite , "ne with integer" ) + + test = test_so.obj.ikg != 20.5 + TRICK_EXPECT_EQ( test , True, test_suite , "ne with float" ) + + test = test_so.obj.ikg != test_so.obj.ilbm + TRICK_EXPECT_EQ( test , True, test_suite , "ne with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.ikg != test_so.obj.dkg + TRICK_EXPECT_EQ( test , True, test_suite , "ne with swig_double and unit conversion" ) + + # greater than + + test_so.obj.ikg = 20 + test_so.obj.ilbm = 20 + + test = test_so.obj.ikg > 21 + TRICK_EXPECT_EQ( test , False, test_suite , "gt with integer" ) + + test = test_so.obj.ikg > 20.5 + TRICK_EXPECT_EQ( test , False, test_suite , "gt with float" ) + + test = test_so.obj.ikg > test_so.obj.ilbm + TRICK_EXPECT_EQ( test , True, test_suite , "gt with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.ikg > test_so.obj.dkg + TRICK_EXPECT_EQ( test , False, test_suite , "gt with swig_double and unit conversion" ) + + # greater than or equal + + test_so.obj.ikg = 20 + test_so.obj.ilbm = 20 + + test = test_so.obj.ikg >= 21 + TRICK_EXPECT_EQ( test , False, test_suite , "ge with integer" ) + + test = test_so.obj.ikg >= 20.5 + TRICK_EXPECT_EQ( test , False, test_suite , "ge with float" ) + + test = test_so.obj.ikg >= test_so.obj.ilbm + TRICK_EXPECT_EQ( test , True, test_suite , "ge with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.ikg >= test_so.obj.dkg + TRICK_EXPECT_EQ( test , False, test_suite , "ge with swig_double and unit conversion" ) + + # unary operators + + test_so.obj.ikg = 20 + test = -test_so.obj.ikg + TRICK_EXPECT_EQ( test , -20, test_suite , "unary neg" ) + + test = +test_so.obj.ikg + TRICK_EXPECT_EQ( test , 20, test_suite , "unary pos" ) + + test_so.obj.ikg = -20 + test = abs(test_so.obj.ikg) + TRICK_EXPECT_EQ( test , 20, test_suite , "unary abs" ) + + test_so.obj.ikg = 20 + test = ~test_so.obj.ikg + TRICK_EXPECT_EQ( test , -21, test_suite , "unary invert" ) + + # conversion + test_so.obj.ikg = 20 + test = int(test_so.obj.ikg) + TRICK_EXPECT_EQ( test , 20, test_suite , "int" ) + + test_so.obj.ikg = 20 + test = long(test_so.obj.ikg) + TRICK_EXPECT_EQ( test , 20, test_suite , "long" ) + + test_so.obj.ikg = 20 + test = float(test_so.obj.ikg) + TRICK_EXPECT_EQ( test , 20, test_suite , "float" ) + + test_so.obj.ikg = 20 + test = oct(test_so.obj.ikg) + TRICK_EXPECT_EQ( test , "024", test_suite , "oct" ) + + test_so.obj.ikg = 20 + test = hex(test_so.obj.ikg) + TRICK_EXPECT_EQ( test , "0x14", test_suite , "hex" ) + +###################################################################################################################### + + # swig_integer to swig_double assignment + test_suite = "swig_double" + + test_so.obj.ilbm = 50 + test_so.obj.dlbm = test_so.obj.ilbm + + # swig_double unitless to swig_double assignment + + test_so.obj.dno_units = trick.attach_units("--" , 60.6) + TRICK_EXPECT_EQ( test_so.obj.dno_units , 60.6, test_suite , "assignment from unitless swig_double" ) + trick.trick_test_add_parent( test_suite , "assignment from unitless swig_double" , "1164062396") + + # addition + + test_so.obj.dlbm = 50 + test_so.obj.dkg = test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 22.6796, 0.0001, test_suite , "units conversion" ) + + test_so.obj.dkg = test_so.obj.dlbm + 20 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 31.7515, 0.0001, test_suite , "addition with integer" ) + + test_so.obj.dkg = test_so.obj.dlbm + 20.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 32.1597, 0.0001, test_suite , "addition with float" ) + + test_so.obj.ilbm = 50 + test_so.obj.dkg = test_so.obj.dlbm + test_so.obj.ilbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 45.3592, 0.0001, test_suite , "addition with swig_int" ) + + test_so.obj.dkg = 50 + test_so.obj.ikg = 50 + test_so.obj.dkg = test_so.obj.dlbm + test_so.obj.ikg + TRICK_EXPECT_NEAR( test_so.obj.dkg , 72.6796, 0.0001, test_suite , "addition with swig_int and unit conversion" ) + + test_so.obj.dlbm = 10 + test_so.obj.dkg = test_so.obj.dlbm + test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 9.07185, 0.0001, test_suite , "addition with swig_double" ) + + test_so.obj.dkg = 10 + test_so.obj.dkg = test_so.obj.dlbm + test_so.obj.dkg + TRICK_EXPECT_NEAR( test_so.obj.dkg , 14.5359, 0.0001, test_suite , "addition with swig_double and unit conversion" ) + + # subtraction + + test_so.obj.dlbm = 50 + test_so.obj.dkg = test_so.obj.dlbm - 20 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 13.6078, 0.0001, test_suite , "subtraction with integer" ) + + test_so.obj.dkg = test_so.obj.dlbm - 20.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 13.1995, 0.0001, test_suite , "subtraction with float" ) + + test_so.obj.ilbm = 50 + test_so.obj.dkg = test_so.obj.dlbm - test_so.obj.ilbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 0, 0.0001, test_suite , "subtraction with swig_int" ) + + test_so.obj.dkg = 50 + test_so.obj.ikg = 50 + test_so.obj.dkg = test_so.obj.dlbm - test_so.obj.ikg + TRICK_EXPECT_NEAR( test_so.obj.dkg , -27.3204, 0.0001, test_suite , "subtraction with swig_int and unit conversion" ) + + test_so.obj.dlbm = 10 + test_so.obj.dkg = test_so.obj.dlbm - test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 0, 0.0001, test_suite , "subtraction with swig_double" ) + + test_so.obj.dkg = 10 + test_so.obj.dkg = test_so.obj.dlbm - test_so.obj.dkg + TRICK_EXPECT_NEAR( test_so.obj.dkg , -5.46408, 0.0001, test_suite , "subtraction with swig_double and unit conversion" ) + + # multiplication + + test_so.obj.dlbm = 50 + test_so.obj.dkg = test_so.obj.dlbm * 3 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 68.0389, 0.0001, test_suite , "multiplication with int" ) + + test_so.obj.dkg = test_so.obj.ilbm * 2.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 65.7709, 0.0001, test_suite , "multiplication with float" ) + + test_so.obj.dlbm = 50 + test_so.obj.i = 2 + test_so.obj.dkg = test_so.obj.dlbm * test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 45.3592, 0.0001, test_suite , "multiplication with unitless swig_int" ) + + test_so.obj.dlbm = 50 + test_so.obj.dno_units = 2.2 + test_so.obj.dkg = test_so.obj.dlbm * test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 49.8952, 0.0001, test_suite , "multiplication with unitless swig_double" ) + + # division + + test_so.obj.dlbm = 50 + test_so.obj.dkg = test_so.obj.dlbm / 3 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 7.55987, 0.0001, test_suite , "division with int" ) + + test_so.obj.dkg = test_so.obj.dlbm / 2.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 7.82056, 0.0001, test_suite , "division with float" ) + + test_so.obj.i = 5 + test_so.obj.dkg = test_so.obj.dlbm / test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 4.53592, 0.0001, test_suite , "division with unitless swig_int" ) + + test_so.obj.dno_units = 5.1 + test_so.obj.dkg = test_so.obj.dlbm / test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 4.44698, 0.0001, test_suite , "division with unitless swig_double" ) + + # floor division + + test_so.obj.dkg = 29 + test_so.obj.dkg = test_so.obj.dkg // 4 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 7, 0.0001, test_suite , "floor division with int" ) + + test_so.obj.dkg = 29 + test_so.obj.dkg = test_so.obj.dkg // 4.5 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 6, 0.0001, test_suite , "floor division with float" ) + + test_so.obj.dkg = 29 + test_so.obj.i = 4 + test_so.obj.dkg = test_so.obj.dkg // test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 7, 0.0001, test_suite , "floor division with unitless swig_int" ) + + test_so.obj.dkg = 29 + test_so.obj.dno_units = 4.5 + test_so.obj.dkg = test_so.obj.dkg // test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 6, 0.0001, test_suite , "floor division with unitless swig_double" ) + + + # mod + + test_so.obj.dkg = 29 + test_so.obj.dkg = test_so.obj.dkg % 4 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 1, 0.0001, test_suite , "mod with int" ) + + test_so.obj.dkg = 29 + test_so.obj.dkg = test_so.obj.dkg % 4.5 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 2, 0.0001, test_suite , "mod with float" ) + + test_so.obj.dlbm = 50 + test_so.obj.i = 13 + test_so.obj.dlbm = test_so.obj.dlbm % test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dlbm , 11, 0.0001, test_suite , "mod with unitless swig_int" ) + + test_so.obj.dlbm = 50 + test_so.obj.dno_units = 13.5 + test_so.obj.dlbm = test_so.obj.dlbm % test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dlbm , 9.5, 0.0001, test_suite , "mod with unitless swig_double" ) + + # pow + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = pow(test_so.obj.dno_units , 4) + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 625, 0.0001, test_suite , "pow with int" ) + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = pow(test_so.obj.dno_units , 2.5) + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 55.9017, 0.0001, test_suite , "pow with float" ) + + test_so.obj.i = 5 + test_so.obj.dno_units = 5.0 + test_so.obj.dno_units = pow(test_so.obj.dno_units , test_so.obj.i) + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 3125, 0.0001, test_suite , "pow with unitless swig_int" ) + + test_so.obj.dno_units = 5.0 + test_so.obj.dno_units = pow(test_so.obj.dno_units , test_so.obj.dno_units) + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 3125, 0.0001, test_suite , "pow with unitless swig_double" ) + + # reverse addition + + test_so.obj.dlbm = 10 + test_so.obj.dkg = 20 + test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 13.6078, 0.0001, test_suite , "reverse addition with integer" ) + + test_so.obj.dkg = 20.9 + test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 14.016, 0.0001, test_suite , "reverse addition with float" ) + + # reverse subtraction + + test_so.obj.dkg = 120 - test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 49.8952, 0.0001, test_suite , "reverse subtraction with integer" ) + + test_so.obj.dkg = 120.9 - test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 50.3034, 0.0001, test_suite , "reverse subtraction with float" ) + + # reverse multiplication + + test_so.obj.dlbm = 50 + test_so.obj.dkg = 3 * test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 68.0389, 0.0001, test_suite , "reverse multiplication with int" ) + + test_so.obj.dkg = 2.9 * test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 65.7709, 0.0001, test_suite , "reverse multiplication with float" ) + + + # reverse division + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = 62 / test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 12.4, 0.0001, test_suite , "reverse division with int" ) + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = 62.5 / test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 12.5, 0.0001, test_suite , "reverse division with float" ) + + # reverse floor division + test_so.obj.dno_units = 5 + test_so.obj.dno_units = 62 // test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 12, 0.0001, test_suite , "reverse floor division with int" ) + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = 62.5 // test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 12, 0.0001, test_suite , "reverse floor division with float" ) + + + # reverse mod + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = 62 % test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 2, 0.0001, test_suite , "reverse mod with int" ) + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = 62.5 % test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 2.5, 0.0001, test_suite , "reverse mod with float" ) + + # reverse pow + + test_so.obj.dno_units = 4 + test_so.obj.dno_units = pow(4 , test_so.obj.dno_units) + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 256, 0.0001, test_suite , "reverse pow with int" ) + + test_so.obj.dno_units = 5 + test_so.obj.dno_units = pow(2.1 , test_so.obj.dno_units) + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 40.841 , 0.0001, test_suite , "reverse pow with float" ) + + # in-place addition + + test_so.obj.dkg = 10 + test_so.obj.dkg += 20 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 30, 0.0001, test_suite , "in-place addition with integer" ) + + test_so.obj.dkg += 20.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 50.9, 0.0001, test_suite , "in-place addition with float" ) + + test_so.obj.ilbm = 10 + test_so.obj.dkg += test_so.obj.ilbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 55.4359, 0.0001, test_suite , "in-place addition with swig_int" ) + + test_so.obj.dkg = 10 + test_so.obj.dkg += test_so.obj.dkg + TRICK_EXPECT_NEAR( test_so.obj.dkg , 20, 0.0001, test_suite , "in-place addition with swig_double and unit conversion" ) + + # in-place subtraction + + test_so.obj.dkg = 10 + test_so.obj.dkg -= 2 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 8, 0.0001, test_suite , "in-place subtraction with integer" ) + + test_so.obj.dkg -= 2.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5.1, 0.0001, test_suite , "in-place subtraction with float" ) + + test_so.obj.dlbm = 10 + test_so.obj.dkg -= test_so.obj.dlbm + TRICK_EXPECT_NEAR( test_so.obj.dkg , 0.564076, 0.0001, test_suite , "in-place subtraction with swig_int" ) + + test_so.obj.dkg = 1 + test_so.obj.dkg -= test_so.obj.dkg + TRICK_EXPECT_NEAR( test_so.obj.dkg , 0, 0.0001, test_suite , "in-place subtraction with swig_double and unit conversion" ) + + # in-place multiplication + + test_so.obj.dkg = 10 + test_so.obj.dkg *= 2 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 20, 0.0001, test_suite , "in-place multiplication with integer" ) + + test_so.obj.dkg *= 3.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 78, 0.0001, test_suite , "in-place multiplication with float" ) + + test_so.obj.dkg = 10 + test_so.obj.i = 2 + test_so.obj.dkg *= test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 20, 0.0001, test_suite , "in-place multiplication with unitless swig_int" ) + + test_so.obj.dkg = 10 + test_so.obj.dno_units = 2 + test_so.obj.dkg *= test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 20, 0.0001, test_suite , "in-place multiplication with unitless swig_int" ) + + # in-place division + + test_so.obj.dkg = 10 + test_so.obj.dkg /= 2 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5, 0.0001, test_suite , "in-place division with integer" ) + + test_so.obj.dkg = 10 + test_so.obj.dkg /= 3.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 2.5641, 0.0001, test_suite , "in-place division with float" ) + + test_so.obj.dkg = 10 + test_so.obj.i = 2 + test_so.obj.dkg /= test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) + + test_so.obj.dkg = 10 + test_so.obj.dno_units = 2 + test_so.obj.dkg /= test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) + + # in-place floor division + + test_so.obj.dkg = 10.1 + test_so.obj.dkg //= 2 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5, 0.0001, test_suite , "in-place division with integer" ) + + test_so.obj.dkg = 10.1 + test_so.obj.dkg //= 3.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 2, 0.0001, test_suite , "in-place division with float" ) + + test_so.obj.dkg = 10.1 + test_so.obj.i = 2 + test_so.obj.dkg //= test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) + + test_so.obj.dkg = 10.1 + test_so.obj.dno_units = 2 + test_so.obj.dkg //= test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) + + # in-place mod + + test_so.obj.dkg = 10.1 + test_so.obj.dkg %= 3 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 1.1, 0.0001, test_suite , "in-place mod with integer" ) + + test_so.obj.dkg = 10.1 + test_so.obj.dkg %= 3.9 + TRICK_EXPECT_NEAR( test_so.obj.dkg , 2.3, 0.0001, test_suite , "in-place mod with float" ) + + test_so.obj.dkg = 10.1 + test_so.obj.i = 3 + test_so.obj.dkg %= test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dkg , 1.1, 0.0001, test_suite , "in-place mod with unitless swig_int" ) + + test_so.obj.dkg = 10.1 + test_so.obj.dno_units = 4 + test_so.obj.dkg %= test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dkg , 2.1, 0.0001, test_suite , "in-place mod with unitless swig_double" ) + + # in-place pow + + test_so.obj.dno_units = 5 + test_so.obj.dno_units **= 4 + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 625, 0.0001, test_suite , "in-place pow with int" ) + + test_so.obj.dno_units = 5 + test_so.obj.dno_units **= 2.5 + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 55.9017, 0.0001, test_suite , "in-place pow with float" ) + + test_so.obj.i = 5 + test_so.obj.dno_units = 5.0 + test_so.obj.dno_units **= test_so.obj.i + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 3125, 0.0001, test_suite , "in-place pow with unitless swig_int" ) + + test_so.obj.dno_units = 5.0 + test_so.obj.dno_units **= test_so.obj.dno_units + TRICK_EXPECT_NEAR( test_so.obj.dno_units , 3125, 0.0001, test_suite , "in-place pow with unitless swig_double" ) + + # less than + + test_so.obj.dkg = 20 + test_so.obj.dlbm = 20 + + test = test_so.obj.dkg < 21 + TRICK_EXPECT_EQ( test , True, test_suite , "lt with integer" ) + + test = test_so.obj.dkg < 20.5 + TRICK_EXPECT_EQ( test , True, test_suite , "lt with float" ) + + test = test_so.obj.dkg < test_so.obj.dlbm + TRICK_EXPECT_EQ( test , False, test_suite , "lt with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.dkg < test_so.obj.dkg + TRICK_EXPECT_EQ( test , False, test_suite , "lt with swig_double and unit conversion" ) + + # less than or equal + + test_so.obj.dkg = 20 + test_so.obj.dlbm = 20 + + test = test_so.obj.dkg <= 21 + TRICK_EXPECT_EQ( test , True, test_suite , "le with integer" ) + + test = test_so.obj.dkg <= 20.5 + TRICK_EXPECT_EQ( test , True, test_suite , "le with float" ) + + test = test_so.obj.dkg <= test_so.obj.dlbm + TRICK_EXPECT_EQ( test , False, test_suite , "le with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.dkg <= test_so.obj.dkg + TRICK_EXPECT_EQ( test , True, test_suite , "le with swig_double and unit conversion" ) + + # equal + + test = test_so.obj.dkg == 21 + TRICK_EXPECT_EQ( test , False, test_suite , "eq with integer" ) + + test = test_so.obj.dkg == 20.5 + TRICK_EXPECT_EQ( test , False, test_suite , "eq with float" ) + + test = test_so.obj.dkg == test_so.obj.dlbm + TRICK_EXPECT_EQ( test , False, test_suite , "eq with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.dkg == test_so.obj.dkg + TRICK_EXPECT_EQ( test , True, test_suite , "eq with swig_double and unit conversion" ) + + # not equal + + test = test_so.obj.dkg != 21 + TRICK_EXPECT_EQ( test , True, test_suite , "ne with integer" ) + + test = test_so.obj.dkg != 20.5 + TRICK_EXPECT_EQ( test , True, test_suite , "ne with float" ) + + test = test_so.obj.dkg != test_so.obj.dlbm + TRICK_EXPECT_EQ( test , True, test_suite , "ne with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.dkg != test_so.obj.dkg + TRICK_EXPECT_EQ( test , False, test_suite , "ne with swig_double and unit conversion" ) + + # greater than + + test_so.obj.dkg = 20 + test_so.obj.dlbm = 20 + + test = test_so.obj.dkg > 21 + TRICK_EXPECT_EQ( test , False, test_suite , "gt with integer" ) + + test = test_so.obj.dkg > 20.5 + TRICK_EXPECT_EQ( test , False, test_suite , "gt with float" ) + + test = test_so.obj.dkg > test_so.obj.dlbm + TRICK_EXPECT_EQ( test , True, test_suite , "gt with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.dkg > test_so.obj.dkg + TRICK_EXPECT_EQ( test , False, test_suite , "gt with swig_double and unit conversion" ) + + # greater than or equal + + test_so.obj.dkg = 20 + test_so.obj.dlbm = 20 + + test = test_so.obj.dkg >= 21 + TRICK_EXPECT_EQ( test , False, test_suite , "ge with integer" ) + + test = test_so.obj.dkg >= 20.5 + TRICK_EXPECT_EQ( test , False, test_suite , "ge with float" ) + + test = test_so.obj.dkg >= test_so.obj.dlbm + TRICK_EXPECT_EQ( test , True, test_suite , "ge with swig_int and unit conversion" ) + + test_so.obj.dkg = 20.1 + test = test_so.obj.dkg >= test_so.obj.dkg + TRICK_EXPECT_EQ( test , True, test_suite , "ge with swig_double and unit conversion" ) + + # unary operators + + test_so.obj.dkg = 20 + test = -test_so.obj.dkg + TRICK_EXPECT_NEAR( test , -20, 0.0001, test_suite , "unary neg" ) + + test = +test_so.obj.dkg + TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "unary pos" ) + + test_so.obj.dkg = -20 + test = abs(test_so.obj.dkg) + TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "unary abs" ) + + # conversion + test_so.obj.dkg = 20 + test = int(test_so.obj.dkg) + TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "int" ) + + test_so.obj.dkg = 20 + test = long(test_so.obj.dkg) + TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "long" ) + + test_so.obj.dkg = 20 + test = float(test_so.obj.dkg) + TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "float" ) + +###################################################################################################################### + + # Typedefed integers + test_suite = "typedef" + + test_so.obj.i = 40 + test_so.obj.iii = test_so.obj.i + test_so.obj.aiii = test_so.obj.iii + + TRICK_EXPECT_EQ( test_so.obj.iii , 40, test_suite , "integer from integer" ) + trick.trick_test_add_parent( test_suite , "integer from integer" , "1011083320") + TRICK_EXPECT_EQ( test_so.obj.aiii , 40, test_suite , "integer from another typedefed integer" ) + trick.trick_test_add_parent( test_suite , "integer from another typedefed integer" , "1011083320") + +###################################################################################################################### + + test_suite = "structure" + + # Structs with more than one name + test_so.t.i = 300 + TRICK_EXPECT_EQ( test_so.t.i , 300, test_suite , "multi named structure no unit assignment" ) + + test_so.t.i = trick.attach_units("in", 300) + TRICK_EXPECT_EQ( test_so.t.i , 7, test_suite , "multi named structure with unit assignment" ) + + test_so.t.d = 300 + TRICK_EXPECT_NEAR( test_so.t.d , 300, 0.0001 , test_suite , "multi named structure no unit assignment" ) + + test_so.t.d = trick.attach_units("in", 300) + TRICK_EXPECT_NEAR( test_so.t.d , 7.62 , 0.0001 , test_suite , "multi named structure with unit assignment" ) + +###################################################################################################################### + + # Templates + test_suite = "template" + + # simple template + test_so.obj.my_template_var.var1 = 30.0 + test_so.obj.my_template_var.var2 = 40 + test_so.obj.my_template_var.var3 = 50 + TRICK_EXPECT_NEAR( test_so.obj.my_template_var.var1 , 30.0 , 0.000001 , test_suite , "double assignment" ) + TRICK_EXPECT_EQ( test_so.obj.my_template_var.var2 , 40 , test_suite , "int assignment" ) + TRICK_EXPECT_EQ( test_so.obj.my_template_var.var3 , 50 , test_suite , "short assignment" ) + trick.trick_test_add_parent( test_suite , "double assignment" , "2642836719") + trick.trick_test_add_parent( test_suite , "int assignment" , "2642836719") + trick.trick_test_add_parent( test_suite , "short assignment" , "2642836719") + + + # using typedef from within template + test_so.obj.my_template_var_int = 66 + TRICK_EXPECT_EQ( test_so.obj.my_template_var_int , 66, test_suite , "use typedef from within a template" ) + + # a more convoluted template + test_so.obj.TTT_var.aa = 1000 + TRICK_EXPECT_EQ( test_so.obj.TTT_var.aa , 1000, test_suite , "class complicated integer" ) + + test_so.obj.TTT_var.bb = 2000.0 + TRICK_EXPECT_NEAR( test_so.obj.TTT_var.bb , 2000, 0.0001, test_suite , "class complicated double" ) + +###################################################################################################################### + + # Namespace + test_suite = "namespace" + + test_so.ns_test.mass = trick.attach_units("lbm", 10) + TRICK_EXPECT_NEAR( test_so.ns_test.mass , 4.53592, 0.0001, test_suite , "Class variable with units" ) + trick.trick_test_add_parent( test_suite , "Class variable with units" , "2546878004") + + test_so.ns_test.bbp = trick.alloc_type(2, "my_ns::BB") + test_so.ns_test.bbp[0].str = "hello" + test_so.ns_test.bbp[1].str = "there" + temp = test_so.ns_test.bbp[0].str + " " + test_so.ns_test.bbp[1].str + TRICK_EXPECT_EQ( str(temp) , "hello there", test_suite , "1D Class allocation" ) + trick.trick_test_add_parent( test_suite , "1D Class allocation" , "2546878004") + + test_so.ns_test.bbpp = trick.alloc_type(4, "my_ns::BB *") + test_so.ns_test.bbpp[0] = trick.alloc_type(3, "my_ns::BB") + test_so.ns_test.bbpp[0][0].str = "bark" + test_so.ns_test.bbpp[0][1].str = "meow" + test_so.ns_test.bbpp[0][2].str = "quack" + temp = test_so.ns_test.bbpp[0][0].str + " " + test_so.ns_test.bbpp[0][1].str + " " + test_so.ns_test.bbpp[0][2].str + TRICK_EXPECT_EQ( str(temp) , "bark meow quack", test_suite , "2D Class allocation" ) + trick.trick_test_add_parent( test_suite , "2D Class allocation" , "2546878004") + +###################################################################################################################### + + # Miscellaneous + test_suite = "misc" + + test_so.obj.d = 10 + test_so.obj.ds = 15 + temp = test_so.obj.d + float(test_so.obj.ds) + TRICK_EXPECT_NEAR( temp , 25 , 0.0001 , test_suite , "Forced remove units" ) + trick.trick_test_add_parent( test_suite , "Forced remove units" , "3339258059") + + temp = [ test_so.obj.d , test_so.obj.ds ] + TRICK_EXPECT_EQ( str(temp) , "[10 kg, 15 s]", test_suite , "List with different objects" ) + + test_so.obj.dp = trick.get_address("test_so.obj.d") + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[10 kg]", test_suite , "Get address" ) + + test_so.obj.d += 1 + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[11 kg]", test_suite , "Get address verification" ) + + test_so.obj.da[2] = 45 + test_so.obj.dp = trick.get_address("test_so.obj.da[2]") + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[45 kg]", test_suite , "Get address mid-array" ) + + test_so.obj.dp = trick.get_address("test_so.obj.daa[1][1]") + TRICK_EXPECT_EQ( str(test_so.obj.dp) , "[60 kg]", test_suite , "Get address multi-dimensional mid-array" ) + + temp_array = test_so.obj.daa[1] + TRICK_EXPECT_EQ( str(temp_array) , "[50.1 kg, 60 kg, 52.3 kg]", test_suite , "Local variable reference to array" ) + + # "const int & cir" and "int const & icr" are pointed to i in the Ball_alex constructor + test_so.obj.i = 55 + TRICK_EXPECT_EQ( test_so.obj.cir , 55, test_suite , "Const reference" ) + TRICK_EXPECT_EQ( test_so.obj.icr , 55, test_suite , "Const reference" ) + + #test_so.obj.cir = 99 + #TRICK_EXPECT_EQ( test_so.obj.cir , 55, test_suite , "Const reference immutable test 1" ) + #TRICK_EXPECT_EQ( test_so.obj.icr , 55, test_suite , "Const reference immutable test 1" ) + + #test_so.obj.icr = 98 + #TRICK_EXPECT_EQ( test_so.obj.cir , 55, test_suite , "Const reference immutable test 2" ) + #TRICK_EXPECT_EQ( test_so.obj.icr , 55, test_suite , "Const reference immutable test 2" ) + + test_so.obj.iiia = [ 300 , 400 , 500 , 600 , 700 ] + TRICK_EXPECT_EQ( str(test_so.obj.iiia) , "[300, 400, 500, 600, 700, 0]", test_suite , "Typedeffed integer type" ) + + # scd = static const double, csd = const static double, sdc = static double const + TRICK_EXPECT_NEAR( test_so.obj.scd , 1.2345 , 0.0001 , test_suite , "Static const access" ) + TRICK_EXPECT_NEAR( test_so.obj.csd , 6.7890 , 0.0001 , test_suite , "Static const access" ) + TRICK_EXPECT_NEAR( test_so.obj.sdc , 9.8765 , 0.0001 , test_suite , "Static const access" ) + + # Attempt to change a static const double + #test_so.obj.scd = 90.0 ; + #TRICK_EXPECT_NEAR( test_so.obj.scd , 1.2345 , 0.0001 , test_suite , "Static const immutable test 1" ) + #trick_mm.mmw.mm.read_checkpoint_from_string("test_so.obj.scd = 2.2222 ;") + #TRICK_EXPECT_NEAR( test_so.obj.scd , 1.2345 , 0.0001 , test_suite , "Static const immutable test 2" ) + #test_so.obj.csd = 90.0 ; + #TRICK_EXPECT_NEAR( test_so.obj.csd , 6.7890 , 0.0001 , test_suite , "Static const immutable test 3" ) + #trick_mm.mmw.mm.read_checkpoint_from_string("test_so.obj.csd = 2.2222 ;") + #TRICK_EXPECT_NEAR( test_so.obj.csd , 6.7890 , 0.0001 , test_suite , "Static const immutable test 4" ) + #test_so.obj.sdc = 90.0 ; + #TRICK_EXPECT_NEAR( test_so.obj.sdc , 9.8765 , 0.0001 , test_suite , "Static const immutable test 5" ) + #trick_mm.mmw.mm.read_checkpoint_from_string("test_so.obj.sdc = 2.2222 ;") + #TRICK_EXPECT_NEAR( test_so.obj.sdc , 9.8765 , 0.0001 , test_suite , "Static const immutable test 6" ) + + tester = trick.Test() + output = tester.foo() + TRICK_EXPECT_EQ( output , "called foo", test_suite , "Instantiate class and capture return value" ) + + tester.t = trick.Test() + output = tester.t.foo() + TRICK_EXPECT_EQ( output , "called foo", test_suite , "Instantiate class pointer within class and capture return value" ) + +###################################################################################################################### + + # Standard typedeffed integer types + test_suite = "typedef_ints" + + test_so.obj.i8t = 70 ; + TRICK_EXPECT_EQ( test_so.obj.i8t , 70, test_suite , "int8_t" ) + trick.trick_test_add_parent( test_suite , "int8_t" , "2939597198") + + test_so.obj.ui8t = 71 ; + TRICK_EXPECT_EQ( test_so.obj.ui8t , 71, test_suite , "uint8_t" ) + + test_so.obj.i16t = 80 ; + TRICK_EXPECT_EQ( test_so.obj.i16t , 80, test_suite , "int16_t" ) + + test_so.obj.ui16t = 81 ; + TRICK_EXPECT_EQ( test_so.obj.ui16t , 81, test_suite , "uint16_t" ) + + test_so.obj.i32t = 90 ; + TRICK_EXPECT_EQ( test_so.obj.i32t , 90, test_suite , "int32_t" ) + + test_so.obj.ui32t = 91 ; + TRICK_EXPECT_EQ( test_so.obj.ui32t , 91, test_suite , "uint32_t" ) + + test_so.obj.i64t = 100 ; + TRICK_EXPECT_EQ( test_so.obj.i64t , 100, test_suite , "int64_t" ) + + test_so.obj.ui64t = 101 ; + TRICK_EXPECT_EQ( test_so.obj.ui64t , 101, test_suite , "uint64_t" ) + + test_so.obj.sizet = 111 ; + TRICK_EXPECT_EQ( test_so.obj.sizet , 111, test_suite , "size_t" ) + + test_so.obj.u_c = 121 ; + TRICK_EXPECT_EQ( test_so.obj.u_c , 121, test_suite , "u_char" ) + + test_so.obj.u_s = 131 ; + TRICK_EXPECT_EQ( test_so.obj.u_s , 131, test_suite , "u_short" ) + + test_so.obj.u_i = 141 ; + TRICK_EXPECT_EQ( test_so.obj.u_i , 141, test_suite , "u_int" ) + + test_so.obj.u_l = 151 ; + TRICK_EXPECT_EQ( test_so.obj.u_l , 151, test_suite , "u_long" ) + + test_so.obj.q = 161 ; + TRICK_EXPECT_EQ( test_so.obj.q , 161, test_suite , "quad_t" ) + + test_so.obj.uq = 171 ; + TRICK_EXPECT_EQ( test_so.obj.uq , 171, test_suite , "u_quad_t" ) + +###################################################################################################################### + + # Exceptions + + test_suite = "exception" + + test_case = "Array index out of bounds" + try: + test_so.obj.da[5] = 2.0 + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "Double dimension array first index out of bounds" + try: + test_so.obj.daa[20][0] = 2.0 + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "Double dimension array second index out of bounds" + try: + test_so.obj.daa[0][20] = 2.0 + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "String too long" + try: + test_so.obj.ca = "dfjdslfjdsajfldjalfjdslafjdlsajfdsd" + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "Units mismatch" + try: + test_so.obj.da[2] = trick.attach_units("s" , 2.0) + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "unit-ed value assigned to unitless variable" + try: + test_so.obj.dno_units = trick.attach_units("in" , 60.6) + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "unit-ed value assigned to unitless integer array variable" + try: + test_so.obj.ia = trick.attach_units("in" , [60, 70]) + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + + test_case = "unit-ed value assigned to unitless integer pointer variable" + try: + test_so.obj.ip = trick.attach_units("in" , [60, 70]) + trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") + except: + trick.add_test_result( test_suite , test_case , "") + +###################################################################################################################### + + # Polymorphic assignments and access + test_suite = "polymorphism" + + test_so.a = trick.Cat() + TRICK_EXPECT_EQ( test_so.a.id , 1, test_suite , "single abstract ptr" ) + trick.trick_test_add_parent( test_suite , "single abstract ptr" , "1770735610") + #test_so.a.speak() + #test_so.a[0].speak() + test_so.a = trick.Dog() + TRICK_EXPECT_EQ( test_so.a.id , 2, test_suite , "single abstract ptr" ) + + test_so.aarray[0] = trick.Cat() + test_so.aarray[1] = trick.Dog() + ids = [ test_so.aarray[0].id , test_so.aarray[1].id ] + TRICK_EXPECT_EQ( str(ids), "[1, 2]", test_suite , "fixed array of abstract ptrs" ) + #test_so.aarray[0].speak() + #test_so.aarray[1].speak() + + test_so.alist = trick.TMM_declare_var_1d("Abstract *", 4) + + test_so.alist[0] = trick.TMM_declare_var_s("Cat") + test_so.alist[1] = trick.TMM_declare_var_s("Dog") + test_so.alist[2] = trick.Cat() + test_so.alist[3] = trick.Dog() + ids = [ test_so.alist[0].id , test_so.alist[1].id , test_so.alist[2].id , test_so.alist[3].id ] + TRICK_EXPECT_EQ( str(ids), "[1, 2, 1, 2]", test_suite , "fixed array of abstract ptrs" ) + #test_so.alist[0].speak() + #test_so.alist[1].speak() + #test_so.alist[2].speak() + #test_so.alist[3].speak() + + # test vector of abstract pointers + new_cat = trick.TMM_declare_var(trick.TRICK_STRUCTURED,"Cat",0,"my_cat",0,None) + test_so.vap.push_back(new_cat) + TRICK_EXPECT_EQ( test_so.vap[0].id , 1, test_suite , "std::vector of abstract ptrs" ) + + new_dog = trick.TMM_declare_var(trick.TRICK_STRUCTURED,"Dog",0,"my_dog",0,None) + test_so.vap.push_back(new_dog) + TRICK_EXPECT_EQ( test_so.vap[1].id , 2, test_suite , "std::vector of abstract ptrs" ) + + #test_so.vap[0].speak() + #test_so.vap[1].speak() + + #drg0 = trick.DRAscii("cat_stuff") + #drg0.add_variable("my_cat.id") + #drg0.add_variable("my_dog.id") + #drg0.set_cycle(0.1) + #drg0.freq = trick.DR_Always + #drg0.thisown = 0 + #trick.add_data_record_group(drg0, trick.DR_Buffer) + + test_so.vap2.push_back(new_dog) + test_so.vap2.push_back(new_cat) + + # vector of vectors (experimental. It does work!) + test_so.vvap.push_back(test_so.vap) + test_so.vvap.push_back(test_so.vap2) + #test_so.vvap[0][0].speak() + #test_so.vvap[0][1].speak() + #test_so.vvap[1][0].speak() + #test_so.vvap[1][1].speak() + +###################################################################################################################### + + test_suite = "array_sclicing" + + # fixed array + test_so.obj.ia = [ 10 , 20 , 30 ] + TRICK_EXPECT_EQ( str(test_so.obj.ia[:]), "[10, 20, 30]", test_suite , "full slice, fixed array" ) + TRICK_EXPECT_EQ( str(test_so.obj.ia[1:]), "[20, 30]", test_suite , "slice with start value, fixed array" ) + TRICK_EXPECT_EQ( str(test_so.obj.ia[:2]), "[10, 20]", test_suite , "slice with end value, fixed array" ) + TRICK_EXPECT_EQ( str(test_so.obj.ia[::2]), "[10, 30]", test_suite , "sclice with step value, fixed array" ) + TRICK_EXPECT_EQ( str(test_so.obj.ia[-3:-1]), "[10, 20]", test_suite , "slice with negative start and end value, fixed array" ) + TRICK_EXPECT_EQ( str(test_so.obj.ia[::-2]), "[30, 10]", test_suite , "slice with negative step, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[1:1] = 400 + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[10, 400, 20]", test_suite , "slice insertion with scalar value, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[1:1] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[10, 400, 500]", test_suite , "slice insertion of list, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[1:2] = 400 + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[10, 400, 30]", test_suite , "slice replacement with scalar value, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[0:1] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[400, 500, 20]", test_suite , "slice replacement list larger than sclice, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[0:2] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[400, 500, 30]", test_suite , "slice replacement list same size as sclice, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[0:3] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[400, 500, 0]", test_suite , "slice replacement list smaller than slice, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[:] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[400, 500, 0]", test_suite , "slice replacement full array, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[0:2:2] = 400 + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[400, 20, 30]", test_suite , "slice replacement with scalar and step, fixed array" ) + + test_so.obj.ia = [ 10 , 20 , 30] + test_so.obj.ia[0:3:2] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ia), "[400, 20, 500]", test_suite , "slice replacement with list and step, fixed array" ) + + # pointer + test_so.obj.ip = [ 10 , 20 , 30 , 40 ] + TRICK_EXPECT_EQ( str(test_so.obj.ip[:]), "[10, 20, 30, 40]", test_suite , "full slice, pointer" ) + TRICK_EXPECT_EQ( str(test_so.obj.ip[1:]), "[20, 30, 40]", test_suite , "slice with start value, pointer" ) + TRICK_EXPECT_EQ( str(test_so.obj.ip[:2]), "[10, 20]", test_suite , "slice with end value, pointer" ) + TRICK_EXPECT_EQ( str(test_so.obj.ip[::2]), "[10, 30]", test_suite , "sclice with step value, pointer" ) + TRICK_EXPECT_EQ( str(test_so.obj.ip[-3:-1]), "[20, 30]", test_suite , "slice with negative start and end value, pointer" ) + TRICK_EXPECT_EQ( str(test_so.obj.ip[::-2]), "[40, 20]", test_suite , "slice with negative step, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:1] = 400 + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 20, 30, 40]", test_suite , "slice insertion with scalar value, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:1] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 500, 20, 30]", test_suite , "slice insertion of list, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:2] = 400 + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 30, 40, 50]", test_suite , "slice replacement with scalar value, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:2] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 500, 30, 40]", test_suite , "slice replacement list larger than sclice, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:3] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 500, 40, 50]", test_suite , "slice replacement list same size as sclice, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:4] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 500, 50, 0]", test_suite , "slice replacement list smaller than slice, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[:] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[400, 500, 0, 0, 0]", test_suite , "slice replacement full array, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:3:2] = 400 + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 30, 40, 50]", test_suite , "slice replacement with scalar and step, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:4:2] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 30, 500, 50]", test_suite , "slice replacement with list and step, pointer" ) + + test_so.obj.ip = [ 10 , 20 , 30 , 40 , 50] + test_so.obj.ip[1:5:2] = [400 , 500] + TRICK_EXPECT_EQ( str(test_so.obj.ip), "[10, 400, 30, 500, 50]", test_suite , "slice replacement with list and step, pointer" ) + +###################################################################################################################### + + test_suite = "STL list support" + + #print dir(test_so.obj.ls) + + TRICK_EXPECT_EQ( test_so.obj.ls.empty(), 1, test_suite , "STL list empty true" ) + test_so.obj.ls.push_back('string 1') + test_so.obj.ls.push_front('string 2') + test_so.obj.ls.push_back('string 3') + TRICK_EXPECT_EQ( test_so.obj.ls.empty(), 0, test_suite , "STL list empty false" ) + TRICK_EXPECT_EQ( test_so.obj.ls.front(), "string 2", test_suite , "STL list front access" ) + TRICK_EXPECT_EQ( test_so.obj.ls.back(), "string 3", test_suite , "STL list back access" ) + TRICK_EXPECT_EQ( test_so.obj.ls.size(), 3, test_suite , "STL list size command" ) + + #test_so.obj.ls.insert(test_so.obj.ls.begin(), 'string 4') + #test_so.obj.ls.pop_front() + #test_so.obj.ls.erase(test_so.obj.ls.begin()) + #for l in test_so.obj.ls: + # print l + +###################################################################################################################### + + test_suite = "STL map support" + + TRICK_EXPECT_EQ( test_so.obj.msi.empty(), 1, test_suite , "STL map empty true" ) + + test_so.obj.msi['key1'] = 50 + test_so.obj.msi['key2'] = 60 + test_so.obj.msi['key3'] = 70 + + TRICK_EXPECT_EQ( test_so.obj.msi.empty(), 0, test_suite , "STL map empty false" ) + TRICK_EXPECT_EQ( test_so.obj.msi['key1'], 50, test_suite , "STL map key/data insertion/access" ) + TRICK_EXPECT_EQ( str(test_so.obj.msi.keys()), "['key1', 'key2', 'key3']", test_suite , "STL map keys command" ) + TRICK_EXPECT_EQ( str(test_so.obj.msi.values()), "[50, 60, 70]", test_suite , "STL map values command" ) + TRICK_EXPECT_EQ( test_so.obj.msi.has_key('key1'), 1, test_suite , "STL map has_key true" ) + TRICK_EXPECT_EQ( test_so.obj.msi.has_key('key4'), 0, test_suite , "STL map has_key false" ) + TRICK_EXPECT_EQ( test_so.obj.msi.size(), 3, test_suite , "STL map size command" ) + #print dict(test_so.obj.msi) + +###################################################################################################################### + + test_suite = "Templated SimObject" + + TRICK_EXPECT_EQ( tso.t, 25, test_suite , "templated sim_object access member" ) + TRICK_EXPECT_EQ( iftso.t, 25, test_suite , "inherit from templated sim_object access member" ) + +###################################################################################################################### + + test_suite = "Templated SimObject" + TRICK_EXPECT_TRUE( test_so.test_true(), test_suite , "boolean function return" ) + TRICK_EXPECT_FALSE( test_so.test_false(), test_suite , "boolean function return" ) + +###################################################################################################################### + +if __name__ == "__main__": + main() + diff --git a/trick_sims/SIM_test_ip/S_define b/test/SIM_test_ip/S_define similarity index 76% rename from trick_sims/SIM_test_ip/S_define rename to test/SIM_test_ip/S_define index 5dde6a86..eef7b547 100644 --- a/trick_sims/SIM_test_ip/S_define +++ b/test/SIM_test_ip/S_define @@ -8,11 +8,10 @@ LIBRARY DEPENDENCIES: #include "sim_objects/default_trick_sys.sm" -##include "test_ip/include/Ball_test.hh" +##include "test_ip/include/ClassOfEverything.hh" ##include "test_ip/include/OverloadedVariable.hh" -/* base ball... get it? :) */ -class ballSimObject : public Trick::SimObject { +class testSimObject : public Trick::SimObject { public: bool test_false() { @@ -22,7 +21,7 @@ class ballSimObject : public Trick::SimObject { return true ; } - Ball_alex obj ; + ClassOfEverything obj ; TEST_STRUCT t ; my_ns::AA ns_test ; Abstract * a ; @@ -39,24 +38,11 @@ class ballSimObject : public Trick::SimObject { MomMom * mm ; #endif - ballSimObject() { - ("default_data") obj.force.default_data() ; - ("default_data") obj.state.default_data() ; - - ("initialization") obj.state_init() ; - - ("derivative") obj.force_field() ; - ("derivative") obj.state_deriv() ; - ("integration") trick_ret = obj.state_integ() ; - - (10.0, "scheduled") trick_ret = obj.state_print() ; - - ("freeze") obj.state_print() ; - } + testSimObject() {} private: - ballSimObject (const ballSimObject &); - ballSimObject & operator= (const ballSimObject &); + testSimObject (const testSimObject &); + testSimObject & operator= (const testSimObject &); } ; @@ -84,7 +70,7 @@ class disabledSimObject : public Trick::SimObject { class emptySimObject : public Trick::SimObject { public: - Ball_alex obj ; + ClassOfEverything obj ; private: emptySimObject (const emptySimObject &); @@ -105,7 +91,7 @@ class plainClass { } // Instantiations -ballSimObject ball ; +testSimObject test_so ; disabledSimObject disabled_obj ; template @@ -154,22 +140,10 @@ class InheritFromTemplatedSimObject : public TemplatedSimObject< int, double > { InheritFromTemplatedSimObject iftso ; -// This collect can now be done in create_connections or the input file. -//collect ball.obj.state.work.external_force = {ball.obj.force.output.force[0]}; - -IntegLoop my_integ_loop (0.01) ball; - // Connect objects void create_connections() { - // Set the default termination time - trick_sys.sched.set_terminate_time(300.0) ; + trick_sys.sched.set_terminate_time(1.0) ; trick_sys.sched.set_freeze_frame(0.10) ; - - - my_integ_loop.getIntegrator( Runge_Kutta_2, 4 ); - - ball.obj.state.add_external_force( ball.obj.force.output.force ) ; - } diff --git a/test/SIM_test_ip/S_overrides.mk b/test/SIM_test_ip/S_overrides.mk new file mode 100644 index 00000000..40a6b97e --- /dev/null +++ b/test/SIM_test_ip/S_overrides.mk @@ -0,0 +1,3 @@ +TRICK_ICG_EXCLUDE=${TRICK_HOME}/trick_models/exclude_me +TRICK_CFLAGS += -I../models +TRICK_CXXFLAGS += -I../models diff --git a/trick_sims/SIM_test_ip/Title b/test/SIM_test_ip/Title similarity index 100% rename from trick_sims/SIM_test_ip/Title rename to test/SIM_test_ip/Title diff --git a/trick_sims/SIM_test_templates/RUN_test/unit_test.py b/test/SIM_test_templates/RUN_test/unit_test.py similarity index 100% rename from trick_sims/SIM_test_templates/RUN_test/unit_test.py rename to test/SIM_test_templates/RUN_test/unit_test.py diff --git a/trick_sims/SIM_test_templates/S_define b/test/SIM_test_templates/S_define similarity index 100% rename from trick_sims/SIM_test_templates/S_define rename to test/SIM_test_templates/S_define diff --git a/test/SIM_test_templates/S_overrides.mk b/test/SIM_test_templates/S_overrides.mk new file mode 100644 index 00000000..a2eff6d4 --- /dev/null +++ b/test/SIM_test_templates/S_overrides.mk @@ -0,0 +1,4 @@ + +TRICK_CFLAGS += -I../models +TRICK_CXXFLAGS += -I../models + diff --git a/trick_sims/SIM_test_templates/Title b/test/SIM_test_templates/Title similarity index 100% rename from trick_sims/SIM_test_templates/Title rename to test/SIM_test_templates/Title diff --git a/trick_models/exclude_me/include/exclude_me.hh b/test/models/exclude_me/include/exclude_me.hh similarity index 100% rename from trick_models/exclude_me/include/exclude_me.hh rename to test/models/exclude_me/include/exclude_me.hh diff --git a/trick_models/test_ip/include/Ball_test.hh b/test/models/test_ip/include/ClassOfEverything.hh similarity index 92% rename from trick_models/test_ip/include/Ball_test.hh rename to test/models/test_ip/include/ClassOfEverything.hh index 06ef4534..97f04cef 100644 --- a/trick_models/test_ip/include/Ball_test.hh +++ b/test/models/test_ip/include/ClassOfEverything.hh @@ -3,20 +3,9 @@ @verbatim PURPOSE: - (Ball model EOM state parameter definition.) -REFERENCES: - (((Bailey, R.W, and Paddock, E.J.) - (Trick Simulation Environment) (NASA:JSC #37943) - (JSC/Engineering Directorate/Automation, Robotics and Simulation Division) - (March 1997))) -ASSUMPTIONS AND LIMITATIONS: - ((2 dimensional space) - (Translational EOM only)) + (Test input processor) LIBRARY DEPENDENCY: - ((Ball_test.o)) -PROGRAMMERS: - (((Robert W. Bailey) (Sweet Systems Inc) (March 1997) (Tutorial Lesson 1)) - ((Edwin Z. Crues)(Titan Systems Corp.)(Jan 2002)(Crude C++ translation))) + ((ClassOfEverything.o)) @endverbatim *******************************************************************************/ @@ -35,7 +24,7 @@ PROGRAMMERS: #include // Model include files. -#include "Ball++/L1/../L1/include/Ball.hh" +#include "trick/mm_macros.hh" #include "test_ip/include/NoICG.hh" #include "exclude_me/include/exclude_me.hh" #include "test_ip/include/Namespace_tests.hh" @@ -78,7 +67,7 @@ typedef const struct ConstStruct_ { class AlsoCannotCopy { friend class InputProcessor ; - friend void init_attrBall_alex() ; + friend void init_attrClassOfEverything() ; public: int i ; @@ -93,7 +82,7 @@ class AlsoCannotCopy { class CannotCopy { friend class InputProcessor ; - friend void init_attrBall_alex() ; + friend void init_attrClassOfEverything() ; public: int i ; @@ -182,15 +171,15 @@ typedef int Integer ; typedef int AnotherInteger ; typedef long long Myint64 ; -class Ball_alex : public Ball { +class ClassOfEverything { friend class InputProcessor ; - friend void init_attrBall_alex() ; + friend void init_attrClassOfEverything() ; public: // Default constructor and destructor. - Ball_alex() ; - ~Ball_alex() {}; + ClassOfEverything() ; + ~ClassOfEverything() {}; /* maybe someday we'll be able to do something like this. */ double d_test ; /* -- blah */ @@ -391,8 +380,8 @@ class Ball_alex : public Ball { typedef int sizeType ; typedef double mydouble ; - Ball_alex::sizeType st ; - Ball_alex::mydouble md ; + ClassOfEverything::sizeType st ; + ClassOfEverything::mydouble md ; MyTemplate< double , int , short >::template_int my_template_var_int ; int invisible_int ; @@ -450,8 +439,8 @@ class Ball_alex : public Ball { std::list < std::string > ls ; private: - Ball_alex (const Ball_alex &); - Ball_alex & operator= (const Ball_alex &); + ClassOfEverything (const ClassOfEverything &); + ClassOfEverything & operator= (const ClassOfEverything &); }; @@ -466,7 +455,7 @@ typedef struct test_struct { } TEST_STRUCT ; #ifdef SWIG -%struct_str(Ball_alex) +%struct_str(ClassOfEverything) #endif namespace my_ns { @@ -492,6 +481,7 @@ class Test { class Abstract { public: Abstract( int in_id ) : id(in_id) {} ; + virtual ~Abstract() {} ; int id ; virtual void speak() = 0 ; } ; diff --git a/trick_models/test_ip/include/EmbeddedClasses.hh b/test/models/test_ip/include/EmbeddedClasses.hh similarity index 100% rename from trick_models/test_ip/include/EmbeddedClasses.hh rename to test/models/test_ip/include/EmbeddedClasses.hh diff --git a/trick_models/test_ip/include/Namespace_tests.hh b/test/models/test_ip/include/Namespace_tests.hh similarity index 68% rename from trick_models/test_ip/include/Namespace_tests.hh rename to test/models/test_ip/include/Namespace_tests.hh index cc35a590..9977fcd8 100644 --- a/trick_models/test_ip/include/Namespace_tests.hh +++ b/test/models/test_ip/include/Namespace_tests.hh @@ -3,20 +3,7 @@ @verbatim PURPOSE: - (Ball model EOM state parameter definition.) -REFERENCES: - (((Bailey, R.W, and Paddock, E.J.) - (Trick Simulation Environment) (NASA:JSC #37943) - (JSC/Engineering Directorate/Automation, Robotics and Simulation Division) - (March 1997))) -ASSUMPTIONS AND LIMITATIONS: - ((2 dimensional space) - (Translational EOM only)) -LIBRARY DEPENDENCY: - ((Ball_test.o)) -PROGRAMMERS: - (((Robert W. Bailey) (Sweet Systems Inc) (March 1997) (Tutorial Lesson 1)) - ((Edwin Z. Crues)(Titan Systems Corp.)(Jan 2002)(Crude C++ translation))) + (Namespace input processor tests) @endverbatim *******************************************************************************/ diff --git a/test/models/test_ip/include/NoICG.hh b/test/models/test_ip/include/NoICG.hh new file mode 100644 index 00000000..a8ee7566 --- /dev/null +++ b/test/models/test_ip/include/NoICG.hh @@ -0,0 +1,24 @@ +/** +@file + +@verbatim +PURPOSE: + (ICG test) +ICG: (No) +LIBRARY DEPENDENCY: + () +@endverbatim +*******************************************************************************/ + +#ifndef NOICG_HH +#define NOICG_HH + +class DoNotICG { + + public: + int ii ; + +} ; + +#endif /* _BALL_HH_ */ + diff --git a/trick_models/test_ip/include/OverloadedVariable.hh b/test/models/test_ip/include/OverloadedVariable.hh similarity index 100% rename from trick_models/test_ip/include/OverloadedVariable.hh rename to test/models/test_ip/include/OverloadedVariable.hh diff --git a/trick_models/test_ip/include/TemplateTest.hh b/test/models/test_ip/include/TemplateTest.hh similarity index 56% rename from trick_models/test_ip/include/TemplateTest.hh rename to test/models/test_ip/include/TemplateTest.hh index df982be8..845da5ea 100644 --- a/trick_models/test_ip/include/TemplateTest.hh +++ b/test/models/test_ip/include/TemplateTest.hh @@ -3,20 +3,7 @@ @verbatim PURPOSE: - (Ball model EOM state parameter definition.) -REFERENCES: - (((Bailey, R.W, and Paddock, E.J.) - (Trick Simulation Environment) (NASA:JSC #37943) - (JSC/Engineering Directorate/Automation, Robotics and Simulation Division) - (March 1997))) -ASSUMPTIONS AND LIMITATIONS: - ((2 dimensional space) - (Translational EOM only)) -LIBRARY DEPENDENCY: - () -PROGRAMMERS: - (((Robert W. Bailey) (Sweet Systems Inc) (March 1997) (Tutorial Lesson 1)) - ((Edwin Z. Crues)(Titan Systems Corp.)(Jan 2002)(Crude C++ translation))) + (Template tests) @endverbatim *******************************************************************************/ diff --git a/test/models/test_ip/src/ClassOfEverything.cpp b/test/models/test_ip/src/ClassOfEverything.cpp new file mode 100644 index 00000000..cfd352e1 --- /dev/null +++ b/test/models/test_ip/src/ClassOfEverything.cpp @@ -0,0 +1,21 @@ + +#include "test_ip/include/ClassOfEverything.hh" + +double ClassOfEverything::sdaa[3][3] ; +const double ClassOfEverything::scd = 1.2345 ; +const double ClassOfEverything::csd = 6.7890 ; +const double ClassOfEverything::sdc = 9.8765 ; + +ClassOfEverything::ClassOfEverything() : cir(i), icr(i) { + + unsigned int ii ; + + ep = NULL ; + epp = NULL ; + + for ( ii = 0 ; ii < 4 ; ii++ ) { + eap[ii] = NULL ; + } + +} + diff --git a/trick_models/test_ip/include/NoICG.hh b/trick_models/test_ip/include/NoICG.hh deleted file mode 100644 index 535bae63..00000000 --- a/trick_models/test_ip/include/NoICG.hh +++ /dev/null @@ -1,35 +0,0 @@ -/** -@file - -@verbatim -PURPOSE: - (Ball model EOM state parameter definition.) -ICG: (No) -REFERENCES: - (((Bailey, R.W, and Paddock, E.J.) - (Trick Simulation Environment) (NASA:JSC #37943) - (JSC/Engineering Directorate/Automation, Robotics and Simulation Division) - (March 1997))) -ASSUMPTIONS AND LIMITATIONS: - ((2 dimensional space) - (Translational EOM only)) -LIBRARY DEPENDENCY: - () -PROGRAMMERS: - (((Robert W. Bailey) (Sweet Systems Inc) (March 1997) (Tutorial Lesson 1)) - ((Edwin Z. Crues)(Titan Systems Corp.)(Jan 2002)(Crude C++ translation))) -@endverbatim -*******************************************************************************/ - -#ifndef NOICG_HH -#define NOICG_HH - -class DoNotICG { - - public: - int ii ; - -} ; - -#endif /* _BALL_HH_ */ - diff --git a/trick_models/test_ip/src/Ball_test.cpp b/trick_models/test_ip/src/Ball_test.cpp deleted file mode 100644 index e115d1c5..00000000 --- a/trick_models/test_ip/src/Ball_test.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -#include "test_ip/include/Ball_test.hh" - -double Ball_alex::sdaa[3][3] ; -const double Ball_alex::scd = 1.2345 ; -const double Ball_alex::csd = 6.7890 ; -const double Ball_alex::sdc = 9.8765 ; - -Ball_alex::Ball_alex() : cir(i), icr(i) { - - unsigned int ii ; - - ep = NULL ; - epp = NULL ; - - for ( ii = 0 ; ii < 4 ; ii++ ) { - eap[ii] = NULL ; - } - -} - diff --git a/trick_sims/SIM_rti/RUN_test/unit_test.py b/trick_sims/SIM_rti/RUN_test/unit_test.py deleted file mode 100644 index 7b12ea5e..00000000 --- a/trick_sims/SIM_rti/RUN_test/unit_test.py +++ /dev/null @@ -1,1054 +0,0 @@ - -import math -from trick.unit_test import * - -def main(): - - my_integ_loop.getIntegrator( trick.Runge_Kutta_2, 4 ); - - # An example of removing collect in the input file (original collect added in S_define file) - #ball.obj.state.work.external_force = trick.delete_collect(ball.obj.state.work.external_force, ball.obj.force.output.force) - # An example of adding a collect in the input file - #ball.obj.state.work.external_force = trick.add_collect(ball.obj.state.work.external_force, ball.obj.force.output.force) - - # An example of turning off a sim_object - trick.exec_set_sim_object_onoff("disabled_obj" , False) - - trick.exec_set_terminate_time(1.0) - - trick_utest.unit_tests.enable() - trick_utest.unit_tests.set_file_name( os.getenv("TRICK_HOME") + "/trick_test/SIM_test_ip_rti.xml" ) - trick_utest.unit_tests.set_test_name( "RTI" ) - -###################################################################################################################### - - test_suite = "rti_add_int" - - ball.obj.d = 0.0 - trick.rti_add("ball.obj.d", 50) - ball.obj.da[1] = 0.0 - trick.rti_add("ball.obj.da[1]", 51) - ball.obj.dp = trick.TMM_declare_var_s("double[6]") - trick.rti_add("ball.obj.dp[1]", 52) - ball.obj.daa[1][1] = 0.0 - trick.rti_add("ball.obj.daa[1][1]", 53) - ball.obj.dap[1] = trick.TMM_declare_var_1d( "double", 4) - trick.rti_add("ball.obj.dap[1][1]", 54) - ball.obj.dpp = trick.TMM_declare_var_s("double *[4]") - ball.obj.dpp[1] = trick.TMM_declare_var_1d( "double", 5) - trick.rti_add("ball.obj.dpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_NEAR( ball.obj.d , 50.0 , 0.000001 , test_suite , "double" ) - TRICK_EXPECT_NEAR( ball.obj.da[1] , 51.0 , 0.000001 , test_suite , "double array" ) - TRICK_EXPECT_NEAR( ball.obj.dp[1] , 52.0 , 0.000001 , test_suite , "double pointer" ) - TRICK_EXPECT_NEAR( ball.obj.daa[1][1] , 53.0 , 0.000001 , test_suite , "2D double array" ) - TRICK_EXPECT_NEAR( ball.obj.dap[1][1] , 54.0 , 0.000001 , test_suite , "2D double array of ptr" ) - TRICK_EXPECT_NEAR( ball.obj.dpp[1][1] , 55.0 , 0.000001 , test_suite , "2D double ptr of ptr" ) - -###################################################################################################################### - - ball.obj.f = 0.0 - trick.rti_add("ball.obj.f", 50) - ball.obj.fa[1] = 0.0 - trick.rti_add("ball.obj.fa[1]", 51) - ball.obj.fp = trick.TMM_declare_var_s("float[6]") - trick.rti_add("ball.obj.fp[1]", 52) - ball.obj.faa[1][1] = 0.0 - trick.rti_add("ball.obj.faa[1][1]", 53) - ball.obj.fap[1] = trick.TMM_declare_var_1d( "float", 4) - trick.rti_add("ball.obj.fap[1][1]", 54) - ball.obj.fpp = trick.TMM_declare_var_s("float *[4]") - ball.obj.fpp[1] = trick.TMM_declare_var_1d( "float", 5) - trick.rti_add("ball.obj.fpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_NEAR( ball.obj.f , 50.0 , 0.000001 , test_suite , "float" ) - TRICK_EXPECT_NEAR( ball.obj.fa[1] , 51.0 , 0.000001 , test_suite , "float array" ) - TRICK_EXPECT_NEAR( ball.obj.fp[1] , 52.0 , 0.000001 , test_suite , "float pointer" ) - TRICK_EXPECT_NEAR( ball.obj.faa[1][1] , 53.0 , 0.000001 , test_suite , "2D float array" ) - TRICK_EXPECT_NEAR( ball.obj.fap[1][1] , 54.0 , 0.000001 , test_suite , "2D float array of ptr" ) - TRICK_EXPECT_NEAR( ball.obj.fpp[1][1] , 55.0 , 0.000001 , test_suite , "2D float ptr of ptr" ) - -###################################################################################################################### - - ball.obj.c = 0 - trick.rti_add("ball.obj.c", 50) - ball.obj.ca[1] = 0 - trick.rti_add("ball.obj.ca[1]", 51) - ball.obj.cp = trick.TMM_declare_var_s("char[6]") - trick.rti_add("ball.obj.cp[1]", 52) - ball.obj.caa[1][1] = 0 - trick.rti_add("ball.obj.caa[1][1]", 53) - ball.obj.cap[1] = trick.TMM_declare_var_1d( "char", 4) - trick.rti_add("ball.obj.cap[1][1]", 54) - ball.obj.cpp = trick.TMM_declare_var_s("char *[4]") - ball.obj.cpp[1] = trick.TMM_declare_var_1d( "char", 5) - trick.rti_add("ball.obj.cpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.c , 50 , test_suite , "char" ) - TRICK_EXPECT_EQ( ball.obj.ca[1] , 51 , test_suite , "char array" ) - TRICK_EXPECT_EQ( ball.obj.cp[1] , 52 , test_suite , "char pointer" ) - TRICK_EXPECT_EQ( ball.obj.caa[1][1] , 53 , test_suite , "2D char array" ) - TRICK_EXPECT_EQ( ball.obj.cap[1][1] , 54 , test_suite , "2D char array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.cpp[1][1] , 55 , test_suite , "2D char ptr of ptr" ) - -###################################################################################################################### - - ball.obj.uc = 0 - trick.rti_add("ball.obj.uc", 50) - ball.obj.uca[1] = 0 - trick.rti_add("ball.obj.uca[1]", 51) - ball.obj.ucp = trick.TMM_declare_var_s("unsigned char[6]") - trick.rti_add("ball.obj.ucp[1]", 52) - ball.obj.ucaa[1][1] = 0 - trick.rti_add("ball.obj.ucaa[1][1]", 53) - ball.obj.ucap[1] = trick.TMM_declare_var_1d( "unsigned char", 4) - trick.rti_add("ball.obj.ucap[1][1]", 54) - ball.obj.ucpp = trick.TMM_declare_var_s("unsigned char *[4]") - ball.obj.ucpp[1] = trick.TMM_declare_var_1d( "unsigned char", 5) - trick.rti_add("ball.obj.ucpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.uc , 50 , test_suite , "unsigned char" ) - TRICK_EXPECT_EQ( ball.obj.uca[1] , 51 , test_suite , "unsigned char array" ) - TRICK_EXPECT_EQ( ball.obj.ucp[1] , 52 , test_suite , "unsigned char pointer" ) - TRICK_EXPECT_EQ( ball.obj.ucaa[1][1] , 53 , test_suite , "2D unsigned char array" ) - TRICK_EXPECT_EQ( ball.obj.ucap[1][1] , 54 , test_suite , "2D unsigned char array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ucpp[1][1] , 55 , test_suite , "2D unsigned char ptr of ptr" ) - -###################################################################################################################### - - ball.obj.s = 0 - trick.rti_add("ball.obj.s", 50) - ball.obj.sa[1] = 0 - trick.rti_add("ball.obj.sa[1]", 51) - ball.obj.sp = trick.TMM_declare_var_s("short[6]") - trick.rti_add("ball.obj.sp[1]", 52) - ball.obj.saa[1][1] = 0 - trick.rti_add("ball.obj.saa[1][1]", 53) - ball.obj.sap[1] = trick.TMM_declare_var_1d( "short", 4) - trick.rti_add("ball.obj.sap[1][1]", 54) - ball.obj.spp = trick.TMM_declare_var_s("short *[4]") - ball.obj.spp[1] = trick.TMM_declare_var_1d( "short", 5) - trick.rti_add("ball.obj.spp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.s , 50 , test_suite , "short" ) - TRICK_EXPECT_EQ( ball.obj.sa[1] , 51 , test_suite , "short array" ) - TRICK_EXPECT_EQ( ball.obj.sp[1] , 52 , test_suite , "short pointer" ) - TRICK_EXPECT_EQ( ball.obj.saa[1][1] , 53 , test_suite , "2D short array" ) - TRICK_EXPECT_EQ( ball.obj.sap[1][1] , 54 , test_suite , "2D short array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.spp[1][1] , 55 , test_suite , "2D short ptr of ptr" ) - -###################################################################################################################### - - ball.obj.us = 0 - trick.rti_add("ball.obj.us", 50) - ball.obj.usa[1] = 0 - trick.rti_add("ball.obj.usa[1]", 51) - ball.obj.usp = trick.TMM_declare_var_s("unsigned short[6]") - trick.rti_add("ball.obj.usp[1]", 52) - ball.obj.usaa[1][1] = 0 - trick.rti_add("ball.obj.usaa[1][1]", 53) - ball.obj.usap[1] = trick.TMM_declare_var_1d( "unsigned short", 4) - trick.rti_add("ball.obj.usap[1][1]", 54) - ball.obj.uspp = trick.TMM_declare_var_s("unsigned short *[4]") - ball.obj.uspp[1] = trick.TMM_declare_var_1d( "unsigned short", 5) - trick.rti_add("ball.obj.uspp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.us , 50 , test_suite , "unsigned short" ) - TRICK_EXPECT_EQ( ball.obj.usa[1] , 51 , test_suite , "unsigned short array" ) - TRICK_EXPECT_EQ( ball.obj.usp[1] , 52 , test_suite , "unsigned short pointer" ) - TRICK_EXPECT_EQ( ball.obj.usaa[1][1] , 53 , test_suite , "2D unsigned short array" ) - TRICK_EXPECT_EQ( ball.obj.usap[1][1] , 54 , test_suite , "2D unsigned short array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.uspp[1][1] , 55 , test_suite , "2D unsigned short ptr of ptr" ) - -###################################################################################################################### - - ball.obj.i = 0 - trick.rti_add("ball.obj.i", 50) - ball.obj.ia[1] = 0 - trick.rti_add("ball.obj.ia[1]", 51) - ball.obj.ip = trick.TMM_declare_var_s("int[6]") - trick.rti_add("ball.obj.ip[1]", 52) - ball.obj.iaa[1][1] = 0 - trick.rti_add("ball.obj.iaa[1][1]", 53) - ball.obj.iap[1] = trick.TMM_declare_var_1d( "int", 4) - trick.rti_add("ball.obj.iap[1][1]", 54) - ball.obj.ipp = trick.TMM_declare_var_s("int *[4]") - ball.obj.ipp[1] = trick.TMM_declare_var_1d( "int", 5) - trick.rti_add("ball.obj.ipp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.i , 50 , test_suite , "int" ) - TRICK_EXPECT_EQ( ball.obj.ia[1] , 51 , test_suite , "int array" ) - TRICK_EXPECT_EQ( ball.obj.ip[1] , 52 , test_suite , "int pointer" ) - TRICK_EXPECT_EQ( ball.obj.iaa[1][1] , 53 , test_suite , "2D int array" ) - TRICK_EXPECT_EQ( ball.obj.iap[1][1] , 54 , test_suite , "2D int array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ipp[1][1] , 55 , test_suite , "2D int ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ui = 0 - trick.rti_add("ball.obj.ui", 50) - ball.obj.uia[1] = 0 - trick.rti_add("ball.obj.uia[1]", 51) - ball.obj.uip = trick.TMM_declare_var_s("unsigned int[6]") - trick.rti_add("ball.obj.uip[1]", 52) - ball.obj.uiaa[1][1] = 0 - trick.rti_add("ball.obj.uiaa[1][1]", 53) - ball.obj.uiap[1] = trick.TMM_declare_var_1d( "unsigned int", 4) - trick.rti_add("ball.obj.uiap[1][1]", 54) - ball.obj.uipp = trick.TMM_declare_var_s("unsigned int *[4]") - ball.obj.uipp[1] = trick.TMM_declare_var_1d( "unsigned int", 5) - trick.rti_add("ball.obj.uipp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ui , 50 , test_suite , "unsigned int" ) - TRICK_EXPECT_EQ( ball.obj.uia[1] , 51 , test_suite , "unsigned int array" ) - TRICK_EXPECT_EQ( ball.obj.uip[1] , 52 , test_suite , "unsigned int pointer" ) - TRICK_EXPECT_EQ( ball.obj.uiaa[1][1] , 53 , test_suite , "2D unsigned int array" ) - TRICK_EXPECT_EQ( ball.obj.uiap[1][1] , 54 , test_suite , "2D unsigned int array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.uipp[1][1] , 55 , test_suite , "2D unsigned int ptr of ptr" ) - -###################################################################################################################### - - ball.obj.l = 0 - trick.rti_add("ball.obj.l", 50) - ball.obj.la[1] = 0 - trick.rti_add("ball.obj.la[1]", 51) - ball.obj.lp = trick.TMM_declare_var_s("long[6]") - trick.rti_add("ball.obj.lp[1]", 52) - ball.obj.laa[1][1] = 0 - trick.rti_add("ball.obj.laa[1][1]", 53) - ball.obj.lap[1] = trick.TMM_declare_var_1d( "long", 4) - trick.rti_add("ball.obj.lap[1][1]", 54) - ball.obj.lpp = trick.TMM_declare_var_s("long *[4]") - ball.obj.lpp[1] = trick.TMM_declare_var_1d( "long", 5) - trick.rti_add("ball.obj.lpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.l , 50 , test_suite , "long" ) - TRICK_EXPECT_EQ( ball.obj.la[1] , 51 , test_suite , "long array" ) - TRICK_EXPECT_EQ( ball.obj.lp[1] , 52 , test_suite , "long polonger" ) - TRICK_EXPECT_EQ( ball.obj.laa[1][1] , 53 , test_suite , "2D long array" ) - TRICK_EXPECT_EQ( ball.obj.lap[1][1] , 54 , test_suite , "2D long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.lpp[1][1] , 55 , test_suite , "2D long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ul = 0 - trick.rti_add("ball.obj.ul", 50) - ball.obj.ula[1] = 0 - trick.rti_add("ball.obj.ula[1]", 51) - ball.obj.ulp = trick.TMM_declare_var_s("unsigned long[6]") - trick.rti_add("ball.obj.ulp[1]", 52) - ball.obj.ulaa[1][1] = 0 - trick.rti_add("ball.obj.ulaa[1][1]", 53) - ball.obj.ulap[1] = trick.TMM_declare_var_1d( "unsigned long", 4) - trick.rti_add("ball.obj.ulap[1][1]", 54) - ball.obj.ulpp = trick.TMM_declare_var_s("unsigned long *[4]") - ball.obj.ulpp[1] = trick.TMM_declare_var_1d( "unsigned long", 5) - trick.rti_add("ball.obj.ulpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ul , 50 , test_suite , "unsigned long" ) - TRICK_EXPECT_EQ( ball.obj.ula[1] , 51 , test_suite , "unsigned long array" ) - TRICK_EXPECT_EQ( ball.obj.ulp[1] , 52 , test_suite , "unsigned long pointer" ) - TRICK_EXPECT_EQ( ball.obj.ulaa[1][1] , 53 , test_suite , "2D unsigned long array" ) - TRICK_EXPECT_EQ( ball.obj.ulap[1][1] , 54 , test_suite , "2D unsigned long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ulpp[1][1] , 55 , test_suite , "2D unsigned long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ll = 0 - trick.rti_add("ball.obj.ll", 50) - ball.obj.lla[1] = 0 - trick.rti_add("ball.obj.lla[1]", 51) - ball.obj.llp = trick.TMM_declare_var_s("long long[6]") - trick.rti_add("ball.obj.llp[1]", 52) - ball.obj.llaa[1][1] = 0 - trick.rti_add("ball.obj.llaa[1][1]", 53) - ball.obj.llap[1] = trick.TMM_declare_var_1d( "long long", 4) - trick.rti_add("ball.obj.llap[1][1]", 54) - ball.obj.llpp = trick.TMM_declare_var_s("long long *[4]") - ball.obj.llpp[1] = trick.TMM_declare_var_1d( "long long", 5) - trick.rti_add("ball.obj.llpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ll , 50 , test_suite , "long long" ) - TRICK_EXPECT_EQ( ball.obj.lla[1] , 51 , test_suite , "long long array" ) - TRICK_EXPECT_EQ( ball.obj.llp[1] , 52 , test_suite , "long long pointer" ) - TRICK_EXPECT_EQ( ball.obj.llaa[1][1] , 53 , test_suite , "2D long long array" ) - TRICK_EXPECT_EQ( ball.obj.llap[1][1] , 54 , test_suite , "2D long long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.llpp[1][1] , 55 , test_suite , "2D long long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ull = 0 - trick.rti_add("ball.obj.ull", 50) - ball.obj.ulla[1] = 0 - trick.rti_add("ball.obj.ulla[1]", 51) - ball.obj.ullp = trick.TMM_declare_var_s("unsigned long long[6]") - trick.rti_add("ball.obj.ullp[1]", 52) - ball.obj.ullaa[1][1] = 0 - trick.rti_add("ball.obj.ullaa[1][1]", 53) - ball.obj.ullap[1] = trick.TMM_declare_var_1d( "unsigned long long", 4) - trick.rti_add("ball.obj.ullap[1][1]", 54) - ball.obj.ullpp = trick.TMM_declare_var_s("unsigned long long *[4]") - ball.obj.ullpp[1] = trick.TMM_declare_var_1d( "unsigned long long", 5) - trick.rti_add("ball.obj.ullpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ull , 50 , test_suite , "unsigned long long" ) - TRICK_EXPECT_EQ( ball.obj.ulla[1] , 51 , test_suite , "unsigned long long array" ) - TRICK_EXPECT_EQ( ball.obj.ullp[1] , 52 , test_suite , "unsigned long long pointer" ) - TRICK_EXPECT_EQ( ball.obj.ullaa[1][1] , 53 , test_suite , "2D unsigned long long array" ) - TRICK_EXPECT_EQ( ball.obj.ullap[1][1] , 54 , test_suite , "2D unsigned long long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ullpp[1][1] , 55 , test_suite , "2D unsigned long long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.e = 0 - trick.rti_add("ball.obj.e", 50) - ball.obj.ea[1] = 0 - trick.rti_add("ball.obj.ea[1]", 51) - ball.obj.ep = trick.TMM_declare_var_s("MY_ENUM[6]") - trick.rti_add("ball.obj.ep[1]", 52) - ball.obj.eaa[1][1] = 0 - trick.rti_add("ball.obj.eaa[1][1]", 53) - ball.obj.eap[1] = trick.TMM_declare_var_1d( "MY_ENUM", 4) - trick.rti_add("ball.obj.eap[1][1]", 54) - ball.obj.epp = trick.TMM_declare_var_s("MY_ENUM *[4]") - ball.obj.epp[1] = trick.TMM_declare_var_1d( "MY_ENUM", 5) - trick.rti_add("ball.obj.epp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.e , 50 , test_suite , "enum" ) - TRICK_EXPECT_EQ( ball.obj.ea[1] , 51 , test_suite , "enum array" ) - TRICK_EXPECT_EQ( ball.obj.ep[1] , 52 , test_suite , "enum pointer" ) - TRICK_EXPECT_EQ( ball.obj.eaa[1][1] , 53 , test_suite , "2D enum array" ) - TRICK_EXPECT_EQ( ball.obj.eap[1][1] , 54 , test_suite , "2D enum array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.epp[1][1] , 55 , test_suite , "2D enum ptr of ptr" ) - -###################################################################################################################### - - ball.obj.b = 0 - trick.rti_add("ball.obj.b", 50) - ball.obj.ba[1] = 0 - trick.rti_add("ball.obj.ba[1]", 51) - ball.obj.bp = trick.TMM_declare_var_s("bool[6]") - trick.rti_add("ball.obj.bp[1]", 52) - ball.obj.baa[1][1] = 0 - trick.rti_add("ball.obj.baa[1][1]", 53) - ball.obj.bap[1] = trick.TMM_declare_var_1d( "bool", 4) - trick.rti_add("ball.obj.bap[1][1]", 54) - ball.obj.bpp = trick.TMM_declare_var_s("bool *[4]") - ball.obj.bpp[1] = trick.TMM_declare_var_1d( "bool", 5) - trick.rti_add("ball.obj.bpp[1][1]", 55) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.b , 1 , test_suite , "bool" ) - TRICK_EXPECT_EQ( ball.obj.ba[1] , 1 , test_suite , "bool array" ) - TRICK_EXPECT_EQ( ball.obj.bp[1] , 1 , test_suite , "bool pointer" ) - TRICK_EXPECT_EQ( ball.obj.baa[1][1] , 1 , test_suite , "2D bool array" ) - TRICK_EXPECT_EQ( ball.obj.bap[1][1] , 1 , test_suite , "2D bool array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.bpp[1][1] , 1 , test_suite , "2D bool ptr of ptr" ) - -###################################################################################################################### - - ball.obj.cbit_0 = 0 - trick.rti_add("ball.obj.cbit_0", -1) - ball.obj.cbit_1 = 0 - trick.rti_add("ball.obj.cbit_1", 31) - ball.obj.cbit_2 = 0 - trick.rti_add("ball.obj.cbit_2", 2) - - ball.obj.ucbit_0 = 0 - trick.rti_add("ball.obj.ucbit_0", 2) - ball.obj.ucbit_1 = 0 - trick.rti_add("ball.obj.ucbit_1", 31) - ball.obj.ucbit_2 = 0 - trick.rti_add("ball.obj.ucbit_2", -1) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - print os.uname()[4] - # The raspberry pi has a bug and returns bitfields in unsigned format. - if os.uname()[4] == 'armv6l': - TRICK_EXPECT_EQ( ball.obj.cbit_0 , 3 , test_suite , "char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.cbit_1 , 7 , test_suite , "char bitfield" ) - else : - TRICK_EXPECT_EQ( ball.obj.cbit_0 , -1 , test_suite , "char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.cbit_1 , -1 , test_suite , "char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.cbit_2 , 2 , test_suite , "char bitfield" ) - - TRICK_EXPECT_EQ( ball.obj.ucbit_0 , 2 , test_suite , "unsigned char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ucbit_1 , 7 , test_suite , "unsigned char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ucbit_2 , 7 , test_suite , "unsigned char bitfield" ) - -###################################################################################################################### - - ball.obj.sbit_0 = 0 - trick.rti_add("ball.obj.sbit_0", -1) - ball.obj.sbit_1 = 0 - trick.rti_add("ball.obj.sbit_1", 255) - ball.obj.sbit_2 = 0 - trick.rti_add("ball.obj.sbit_2", 2) - - ball.obj.usbit_0 = 0 - trick.rti_add("ball.obj.usbit_0", 2) - ball.obj.usbit_1 = 0 - trick.rti_add("ball.obj.usbit_1", 255) - ball.obj.usbit_2 = 0 - trick.rti_add("ball.obj.usbit_2", -1) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.sbit_0 , -1 , test_suite , "short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.sbit_1 , -1 , test_suite , "short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.sbit_2 , 2 , test_suite , "short bitfield" ) - - TRICK_EXPECT_EQ( ball.obj.usbit_0 , 2 , test_suite , "unsigned short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.usbit_1 , 31 , test_suite , "unsigned short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.usbit_2 , 127 , test_suite , "unsigned short bitfield" ) - -###################################################################################################################### - - ball.obj.bit_0 = 0 - trick.rti_add("ball.obj.bit_0", -1) - ball.obj.bit_1 = 0 - trick.rti_add("ball.obj.bit_1", 255) - ball.obj.bit_2 = 0 - trick.rti_add("ball.obj.bit_2", 2) - - ball.obj.ubit_0 = 0 - trick.rti_add("ball.obj.ubit_0", 2) - ball.obj.ubit_1 = 0 - trick.rti_add("ball.obj.ubit_1", 255) - ball.obj.ubit_2 = 0 - trick.rti_add("ball.obj.ubit_2", -1) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.bit_0 , -1 , test_suite , "int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.bit_1 , -1 , test_suite , "int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.bit_2 , 2 , test_suite , "int bitfield" ) - - TRICK_EXPECT_EQ( ball.obj.ubit_0 , 2 , test_suite , "unsigned int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ubit_1 , 31 , test_suite , "unsigned int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ubit_2 , 63 , test_suite , "unsigned int bitfield" ) - -###################################################################################################################### - - # long and long long bitfields are not currently supported by - # sim_services/MemoryManager/src/insert_bitfield_any.c - - #ball.obj.lbit_0 = 0 - #trick.rti_add("ball.obj.lbit_0", -1) - #ball.obj.lbit_1 = 0 - #trick.rti_add("ball.obj.lbit_1", 255) - #ball.obj.lbit_2 = 0 - #trick.rti_add("ball.obj.lbit_2", 2) - - #ball.obj.ulbit_0 = 0 - #trick.rti_add("ball.obj.ulbit_0", 2) - #ball.obj.ulbit_1 = 0 - #trick.rti_add("ball.obj.ulbit_1", 255) - #ball.obj.ulbit_2 = 0 - #trick.rti_add("ball.obj.ulbit_2", -1) - - #trick.rti_fire() - #trick_inject.rtis.GetRtiExecutor(0).Exec() - - #TRICK_EXPECT_EQ( ball.obj.lbit_0 , -1 , test_suite , "long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.lbit_1 , -1 , test_suite , "long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.lbit_2 , 2 , test_suite , "long bitfield" ) - - #TRICK_EXPECT_EQ( ball.obj.ulbit_0 , 2 , test_suite , "unsigned long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.ulbit_1 , 31 , test_suite , "unsigned long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.ulbit_2 , 63 , test_suite , "unsigned long bitfield" ) - -###################################################################################################################### - - ball.obj.boolbit_0 = 0 - trick.rti_add("ball.obj.boolbit_0", 2) - ball.obj.boolbit_1 = 0 - trick.rti_add("ball.obj.boolbit_1", 1) - ball.obj.boolbit_2 = 0 - trick.rti_add("ball.obj.boolbit_2", 255) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.boolbit_0 , 0 , test_suite , "bool bitfield" ) - TRICK_EXPECT_EQ( ball.obj.boolbit_1 , 1 , test_suite , "bool bitfield" ) - TRICK_EXPECT_EQ( ball.obj.boolbit_2 , 1 , test_suite , "bool bitfield" ) - -###################################################################################################################### -###################################################################################################################### - - test_suite = "rti_add_float" - - ball.obj.d = 0.0 - trick.rti_add("ball.obj.d", 50.1) - ball.obj.da[1] = 0.0 - trick.rti_add("ball.obj.da[1]", 51.1) - ball.obj.dp = trick.TMM_declare_var_s("double[6]") - trick.rti_add("ball.obj.dp[1]", 52.1) - ball.obj.daa[1][1] = 0.0 - trick.rti_add("ball.obj.daa[1][1]", 53.1) - ball.obj.dap[1] = trick.TMM_declare_var_1d( "double", 4) - trick.rti_add("ball.obj.dap[1][1]", 54.1) - ball.obj.dpp = trick.TMM_declare_var_s("double *[4]") - ball.obj.dpp[1] = trick.TMM_declare_var_1d( "double", 5) - trick.rti_add("ball.obj.dpp[1][1]", 55.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_NEAR( ball.obj.d , 50.1 , 0.000001 , test_suite , "double" ) - TRICK_EXPECT_NEAR( ball.obj.da[1] , 51.1 , 0.000001 , test_suite , "double array" ) - TRICK_EXPECT_NEAR( ball.obj.dp[1] , 52.1 , 0.000001 , test_suite , "double pointer" ) - TRICK_EXPECT_NEAR( ball.obj.daa[1][1] , 53.1 , 0.000001 , test_suite , "2D double array" ) - TRICK_EXPECT_NEAR( ball.obj.dap[1][1] , 54.1 , 0.000001 , test_suite , "2D double array of ptr" ) - TRICK_EXPECT_NEAR( ball.obj.dpp[1][1] , 55.1 , 0.000001 , test_suite , "2D double ptr of ptr" ) - -###################################################################################################################### - - ball.obj.f = 0.0 - trick.rti_add("ball.obj.f", 50.1) - ball.obj.fa[1] = 0.0 - trick.rti_add("ball.obj.fa[1]", 51.1) - ball.obj.fp = trick.TMM_declare_var_s("float[6]") - trick.rti_add("ball.obj.fp[1]", 52.1) - ball.obj.faa[1][1] = 0.0 - trick.rti_add("ball.obj.faa[1][1]", 53.1) - ball.obj.fap[1] = trick.TMM_declare_var_1d( "float", 4) - trick.rti_add("ball.obj.fap[1][1]", 54.1) - ball.obj.fpp = trick.TMM_declare_var_s("float *[4]") - ball.obj.fpp[1] = trick.TMM_declare_var_1d( "float", 5) - trick.rti_add("ball.obj.fpp[1][1]", 55.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_NEAR( ball.obj.f , 50.1 , 0.00001 , test_suite , "float" ) - TRICK_EXPECT_NEAR( ball.obj.fa[1] , 51.1 , 0.00001 , test_suite , "float array" ) - TRICK_EXPECT_NEAR( ball.obj.fp[1] , 52.1 , 0.00001 , test_suite , "float pointer" ) - TRICK_EXPECT_NEAR( ball.obj.faa[1][1] , 53.1 , 0.00001 , test_suite , "2D float array" ) - TRICK_EXPECT_NEAR( ball.obj.fap[1][1] , 54.1 , 0.00001 , test_suite , "2D float array of ptr" ) - TRICK_EXPECT_NEAR( ball.obj.fpp[1][1] , 55.1 , 0.00001 , test_suite , "2D float ptr of ptr" ) - -###################################################################################################################### - - ball.obj.c = 0 - trick.rti_add("ball.obj.c", 40.1) - ball.obj.ca[1] = 0 - trick.rti_add("ball.obj.ca[1]", 41.1) - ball.obj.cp = trick.TMM_declare_var_s("char[6]") - trick.rti_add("ball.obj.cp[1]", 42.1) - ball.obj.caa[1][1] = 0 - trick.rti_add("ball.obj.caa[1][1]", 43.1) - ball.obj.cap[1] = trick.TMM_declare_var_1d( "char", 4) - trick.rti_add("ball.obj.cap[1][1]", 44.1) - ball.obj.cpp = trick.TMM_declare_var_s("char *[4]") - ball.obj.cpp[1] = trick.TMM_declare_var_1d( "char", 5) - trick.rti_add("ball.obj.cpp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.c , 40 , test_suite , "char" ) - TRICK_EXPECT_EQ( ball.obj.ca[1] , 41 , test_suite , "char array" ) - TRICK_EXPECT_EQ( ball.obj.cp[1] , 42 , test_suite , "char pointer" ) - TRICK_EXPECT_EQ( ball.obj.caa[1][1] , 43 , test_suite , "2D char array" ) - TRICK_EXPECT_EQ( ball.obj.cap[1][1] , 44 , test_suite , "2D char array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.cpp[1][1] , 45 , test_suite , "2D char ptr of ptr" ) - -###################################################################################################################### - - ball.obj.uc = 0 - trick.rti_add("ball.obj.uc", 40.1) - ball.obj.uca[1] = 0 - trick.rti_add("ball.obj.uca[1]", 41.1) - ball.obj.ucp = trick.TMM_declare_var_s("unsigned char[6]") - trick.rti_add("ball.obj.ucp[1]", 42.1) - ball.obj.ucaa[1][1] = 0 - trick.rti_add("ball.obj.ucaa[1][1]", 43.1) - ball.obj.ucap[1] = trick.TMM_declare_var_1d( "unsigned char", 4) - trick.rti_add("ball.obj.ucap[1][1]", 44.1) - ball.obj.ucpp = trick.TMM_declare_var_s("unsigned char *[4]") - ball.obj.ucpp[1] = trick.TMM_declare_var_1d( "unsigned char", 5) - trick.rti_add("ball.obj.ucpp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.uc , 40 , test_suite , "unsigned char" ) - TRICK_EXPECT_EQ( ball.obj.uca[1] , 41 , test_suite , "unsigned char array" ) - TRICK_EXPECT_EQ( ball.obj.ucp[1] , 42 , test_suite , "unsigned char pointer" ) - TRICK_EXPECT_EQ( ball.obj.ucaa[1][1] , 43 , test_suite , "2D unsigned char array" ) - TRICK_EXPECT_EQ( ball.obj.ucap[1][1] , 44 , test_suite , "2D unsigned char array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ucpp[1][1] , 45 , test_suite , "2D unsigned char ptr of ptr" ) - -###################################################################################################################### - - ball.obj.s = 0 - trick.rti_add("ball.obj.s", 40.1) - ball.obj.sa[1] = 0 - trick.rti_add("ball.obj.sa[1]", 41.1) - ball.obj.sp = trick.TMM_declare_var_s("short[6]") - trick.rti_add("ball.obj.sp[1]", 42.1) - ball.obj.saa[1][1] = 0 - trick.rti_add("ball.obj.saa[1][1]", 43.1) - ball.obj.sap[1] = trick.TMM_declare_var_1d( "short", 4) - trick.rti_add("ball.obj.sap[1][1]", 44.1) - ball.obj.spp = trick.TMM_declare_var_s("short *[4]") - ball.obj.spp[1] = trick.TMM_declare_var_1d( "short", 5) - trick.rti_add("ball.obj.spp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.s , 40 , test_suite , "short" ) - TRICK_EXPECT_EQ( ball.obj.sa[1] , 41 , test_suite , "short array" ) - TRICK_EXPECT_EQ( ball.obj.sp[1] , 42 , test_suite , "short pointer" ) - TRICK_EXPECT_EQ( ball.obj.saa[1][1] , 43 , test_suite , "2D short array" ) - TRICK_EXPECT_EQ( ball.obj.sap[1][1] , 44 , test_suite , "2D short array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.spp[1][1] , 45 , test_suite , "2D short ptr of ptr" ) - -###################################################################################################################### - - ball.obj.us = 0 - trick.rti_add("ball.obj.us", 40.1) - ball.obj.usa[1] = 0 - trick.rti_add("ball.obj.usa[1]", 41.1) - ball.obj.usp = trick.TMM_declare_var_s("unsigned short[6]") - trick.rti_add("ball.obj.usp[1]", 42.1) - ball.obj.usaa[1][1] = 0 - trick.rti_add("ball.obj.usaa[1][1]", 43.1) - ball.obj.usap[1] = trick.TMM_declare_var_1d( "unsigned short", 4) - trick.rti_add("ball.obj.usap[1][1]", 44.1) - ball.obj.uspp = trick.TMM_declare_var_s("unsigned short *[4]") - ball.obj.uspp[1] = trick.TMM_declare_var_1d( "unsigned short", 5) - trick.rti_add("ball.obj.uspp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.us , 40 , test_suite , "unsigned short" ) - TRICK_EXPECT_EQ( ball.obj.usa[1] , 41 , test_suite , "unsigned short array" ) - TRICK_EXPECT_EQ( ball.obj.usp[1] , 42 , test_suite , "unsigned short pointer" ) - TRICK_EXPECT_EQ( ball.obj.usaa[1][1] , 43 , test_suite , "2D unsigned short array" ) - TRICK_EXPECT_EQ( ball.obj.usap[1][1] , 44 , test_suite , "2D unsigned short array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.uspp[1][1] , 45 , test_suite , "2D unsigned short ptr of ptr" ) - -###################################################################################################################### - - ball.obj.i = 0 - trick.rti_add("ball.obj.i", 40.1) - ball.obj.ia[1] = 0 - trick.rti_add("ball.obj.ia[1]", 41.1) - ball.obj.ip = trick.TMM_declare_var_s("int[6]") - trick.rti_add("ball.obj.ip[1]", 42.1) - ball.obj.iaa[1][1] = 0 - trick.rti_add("ball.obj.iaa[1][1]", 43.1) - ball.obj.iap[1] = trick.TMM_declare_var_1d( "int", 4) - trick.rti_add("ball.obj.iap[1][1]", 44.1) - ball.obj.ipp = trick.TMM_declare_var_s("int *[4]") - ball.obj.ipp[1] = trick.TMM_declare_var_1d( "int", 5) - trick.rti_add("ball.obj.ipp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.i , 40 , test_suite , "int" ) - TRICK_EXPECT_EQ( ball.obj.ia[1] , 41 , test_suite , "int array" ) - TRICK_EXPECT_EQ( ball.obj.ip[1] , 42 , test_suite , "int pointer" ) - TRICK_EXPECT_EQ( ball.obj.iaa[1][1] , 43 , test_suite , "2D int array" ) - TRICK_EXPECT_EQ( ball.obj.iap[1][1] , 44 , test_suite , "2D int array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ipp[1][1] , 45 , test_suite , "2D int ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ui = 0 - trick.rti_add("ball.obj.ui", 40.1) - ball.obj.uia[1] = 0 - trick.rti_add("ball.obj.uia[1]", 41.1) - ball.obj.uip = trick.TMM_declare_var_s("unsigned int[6]") - trick.rti_add("ball.obj.uip[1]", 42.1) - ball.obj.uiaa[1][1] = 0 - trick.rti_add("ball.obj.uiaa[1][1]", 43.1) - ball.obj.uiap[1] = trick.TMM_declare_var_1d( "unsigned int", 4) - trick.rti_add("ball.obj.uiap[1][1]", 44.1) - ball.obj.uipp = trick.TMM_declare_var_s("unsigned int *[4]") - ball.obj.uipp[1] = trick.TMM_declare_var_1d( "unsigned int", 5) - trick.rti_add("ball.obj.uipp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ui , 40 , test_suite , "unsigned int" ) - TRICK_EXPECT_EQ( ball.obj.uia[1] , 41 , test_suite , "unsigned int array" ) - TRICK_EXPECT_EQ( ball.obj.uip[1] , 42 , test_suite , "unsigned int pointer" ) - TRICK_EXPECT_EQ( ball.obj.uiaa[1][1] , 43 , test_suite , "2D unsigned int array" ) - TRICK_EXPECT_EQ( ball.obj.uiap[1][1] , 44 , test_suite , "2D unsigned int array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.uipp[1][1] , 45 , test_suite , "2D unsigned int ptr of ptr" ) - -###################################################################################################################### - - ball.obj.l = 0 - trick.rti_add("ball.obj.l", 40.1) - ball.obj.la[1] = 0 - trick.rti_add("ball.obj.la[1]", 41.1) - ball.obj.lp = trick.TMM_declare_var_s("long[6]") - trick.rti_add("ball.obj.lp[1]", 42.1) - ball.obj.laa[1][1] = 0 - trick.rti_add("ball.obj.laa[1][1]", 43.1) - ball.obj.lap[1] = trick.TMM_declare_var_1d( "long", 4) - trick.rti_add("ball.obj.lap[1][1]", 44.1) - ball.obj.lpp = trick.TMM_declare_var_s("long *[4]") - ball.obj.lpp[1] = trick.TMM_declare_var_1d( "long", 5) - trick.rti_add("ball.obj.lpp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.l , 40 , test_suite , "long" ) - TRICK_EXPECT_EQ( ball.obj.la[1] , 41 , test_suite , "long array" ) - TRICK_EXPECT_EQ( ball.obj.lp[1] , 42 , test_suite , "long polonger" ) - TRICK_EXPECT_EQ( ball.obj.laa[1][1] , 43 , test_suite , "2D long array" ) - TRICK_EXPECT_EQ( ball.obj.lap[1][1] , 44 , test_suite , "2D long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.lpp[1][1] , 45 , test_suite , "2D long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ul = 0 - trick.rti_add("ball.obj.ul", 40.1) - ball.obj.ula[1] = 0 - trick.rti_add("ball.obj.ula[1]", 41.1) - ball.obj.ulp = trick.TMM_declare_var_s("unsigned long[6]") - trick.rti_add("ball.obj.ulp[1]", 42.1) - ball.obj.ulaa[1][1] = 0 - trick.rti_add("ball.obj.ulaa[1][1]", 43.1) - ball.obj.ulap[1] = trick.TMM_declare_var_1d( "unsigned long", 4) - trick.rti_add("ball.obj.ulap[1][1]", 44.1) - ball.obj.ulpp = trick.TMM_declare_var_s("unsigned long *[4]") - ball.obj.ulpp[1] = trick.TMM_declare_var_1d( "unsigned long", 5) - trick.rti_add("ball.obj.ulpp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ul , 40 , test_suite , "unsigned long" ) - TRICK_EXPECT_EQ( ball.obj.ula[1] , 41 , test_suite , "unsigned long array" ) - TRICK_EXPECT_EQ( ball.obj.ulp[1] , 42 , test_suite , "unsigned long pointer" ) - TRICK_EXPECT_EQ( ball.obj.ulaa[1][1] , 43 , test_suite , "2D unsigned long array" ) - TRICK_EXPECT_EQ( ball.obj.ulap[1][1] , 44 , test_suite , "2D unsigned long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ulpp[1][1] , 45 , test_suite , "2D unsigned long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ll = 0 - trick.rti_add("ball.obj.ll", 40.1) - ball.obj.lla[1] = 0 - trick.rti_add("ball.obj.lla[1]", 41.1) - ball.obj.llp = trick.TMM_declare_var_s("long long[6]") - trick.rti_add("ball.obj.llp[1]", 42.1) - ball.obj.llaa[1][1] = 0 - trick.rti_add("ball.obj.llaa[1][1]", 43.1) - ball.obj.llap[1] = trick.TMM_declare_var_1d( "long long", 4) - trick.rti_add("ball.obj.llap[1][1]", 44.1) - ball.obj.llpp = trick.TMM_declare_var_s("long long *[4]") - ball.obj.llpp[1] = trick.TMM_declare_var_1d( "long long", 5) - trick.rti_add("ball.obj.llpp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ll , 40 , test_suite , "long long" ) - TRICK_EXPECT_EQ( ball.obj.lla[1] , 41 , test_suite , "long long array" ) - TRICK_EXPECT_EQ( ball.obj.llp[1] , 42 , test_suite , "long long pointer" ) - TRICK_EXPECT_EQ( ball.obj.llaa[1][1] , 43 , test_suite , "2D long long array" ) - TRICK_EXPECT_EQ( ball.obj.llap[1][1] , 44 , test_suite , "2D long long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.llpp[1][1] , 45 , test_suite , "2D long long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.ull = 0 - trick.rti_add("ball.obj.ull", 40.1) - ball.obj.ulla[1] = 0 - trick.rti_add("ball.obj.ulla[1]", 41.1) - ball.obj.ullp = trick.TMM_declare_var_s("unsigned long long[6]") - trick.rti_add("ball.obj.ullp[1]", 42.1) - ball.obj.ullaa[1][1] = 0 - trick.rti_add("ball.obj.ullaa[1][1]", 43.1) - ball.obj.ullap[1] = trick.TMM_declare_var_1d( "unsigned long long", 4) - trick.rti_add("ball.obj.ullap[1][1]", 44.1) - ball.obj.ullpp = trick.TMM_declare_var_s("unsigned long long *[4]") - ball.obj.ullpp[1] = trick.TMM_declare_var_1d( "unsigned long long", 5) - trick.rti_add("ball.obj.ullpp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.ull , 40 , test_suite , "unsigned long long" ) - TRICK_EXPECT_EQ( ball.obj.ulla[1] , 41 , test_suite , "unsigned long long array" ) - TRICK_EXPECT_EQ( ball.obj.ullp[1] , 42 , test_suite , "unsigned long long pointer" ) - TRICK_EXPECT_EQ( ball.obj.ullaa[1][1] , 43 , test_suite , "2D unsigned long long array" ) - TRICK_EXPECT_EQ( ball.obj.ullap[1][1] , 44 , test_suite , "2D unsigned long long array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.ullpp[1][1] , 45 , test_suite , "2D unsigned long long ptr of ptr" ) - -###################################################################################################################### - - ball.obj.e = 0 - trick.rti_add("ball.obj.e", 40.1) - ball.obj.ea[1] = 0 - trick.rti_add("ball.obj.ea[1]", 41.1) - ball.obj.ep = trick.TMM_declare_var_s("MY_ENUM[6]") - trick.rti_add("ball.obj.ep[1]", 42.1) - ball.obj.eaa[1][1] = 0 - trick.rti_add("ball.obj.eaa[1][1]", 43.1) - ball.obj.eap[1] = trick.TMM_declare_var_1d( "MY_ENUM", 4) - trick.rti_add("ball.obj.eap[1][1]", 44.1) - ball.obj.epp = trick.TMM_declare_var_s("MY_ENUM *[4]") - ball.obj.epp[1] = trick.TMM_declare_var_1d( "MY_ENUM", 5) - trick.rti_add("ball.obj.epp[1][1]", 45.1) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.e , 40 , test_suite , "enum" ) - TRICK_EXPECT_EQ( ball.obj.ea[1] , 41 , test_suite , "enum array" ) - TRICK_EXPECT_EQ( ball.obj.ep[1] , 42 , test_suite , "enum pointer" ) - TRICK_EXPECT_EQ( ball.obj.eaa[1][1] , 43 , test_suite , "2D enum array" ) - TRICK_EXPECT_EQ( ball.obj.eap[1][1] , 44 , test_suite , "2D enum array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.epp[1][1] , 45 , test_suite , "2D enum ptr of ptr" ) - -###################################################################################################################### - - ball.obj.b = 0 - trick.rti_add("ball.obj.b", 40) - ball.obj.ba[1] = 0 - trick.rti_add("ball.obj.ba[1]", 41) - ball.obj.bp = trick.TMM_declare_var_s("bool[6]") - trick.rti_add("ball.obj.bp[1]", 42) - ball.obj.baa[1][1] = 0 - trick.rti_add("ball.obj.baa[1][1]", 43) - ball.obj.bap[1] = trick.TMM_declare_var_1d( "bool", 4) - trick.rti_add("ball.obj.bap[1][1]", 44) - ball.obj.bpp = trick.TMM_declare_var_s("bool *[4]") - ball.obj.bpp[1] = trick.TMM_declare_var_1d( "bool", 5) - trick.rti_add("ball.obj.bpp[1][1]", 45) - - #trick.rti_list() - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.b , 1 , test_suite , "bool" ) - TRICK_EXPECT_EQ( ball.obj.ba[1] , 1 , test_suite , "bool array" ) - TRICK_EXPECT_EQ( ball.obj.bp[1] , 1 , test_suite , "bool pointer" ) - TRICK_EXPECT_EQ( ball.obj.baa[1][1] , 1 , test_suite , "2D bool array" ) - TRICK_EXPECT_EQ( ball.obj.bap[1][1] , 1 , test_suite , "2D bool array of ptr" ) - TRICK_EXPECT_EQ( ball.obj.bpp[1][1] , 1 , test_suite , "2D bool ptr of ptr" ) - -###################################################################################################################### - - ball.obj.cbit_0 = 0 - trick.rti_add("ball.obj.cbit_0", -1) - ball.obj.cbit_1 = 0 - trick.rti_add("ball.obj.cbit_1", 31) - ball.obj.cbit_2 = 0 - trick.rti_add("ball.obj.cbit_2", 2) - - ball.obj.ucbit_0 = 0 - trick.rti_add("ball.obj.ucbit_0", 2) - ball.obj.ucbit_1 = 0 - trick.rti_add("ball.obj.ucbit_1", 31) - ball.obj.ucbit_2 = 0 - trick.rti_add("ball.obj.ucbit_2", -1) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - # The raspberry pi has a bug and returns bitfields in unsigned format. - if os.uname()[4] == 'armv61': - TRICK_EXPECT_EQ( ball.obj.cbit_0 , 3 , test_suite , "char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.cbit_1 , 7 , test_suite , "char bitfield" ) - else : - TRICK_EXPECT_EQ( ball.obj.cbit_0 , -1 , test_suite , "char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.cbit_1 , -1 , test_suite , "char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.cbit_2 , 2 , test_suite , "char bitfield" ) - - TRICK_EXPECT_EQ( ball.obj.ucbit_0 , 2 , test_suite , "unsigned char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ucbit_1 , 7 , test_suite , "unsigned char bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ucbit_2 , 7 , test_suite , "unsigned char bitfield" ) - -###################################################################################################################### - - ball.obj.sbit_0 = 0 - trick.rti_add("ball.obj.sbit_0", -1) - ball.obj.sbit_1 = 0 - trick.rti_add("ball.obj.sbit_1", 255) - ball.obj.sbit_2 = 0 - trick.rti_add("ball.obj.sbit_2", 2) - - ball.obj.usbit_0 = 0 - trick.rti_add("ball.obj.usbit_0", 2) - ball.obj.usbit_1 = 0 - trick.rti_add("ball.obj.usbit_1", 255) - ball.obj.usbit_2 = 0 - trick.rti_add("ball.obj.usbit_2", -1) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.sbit_0 , -1 , test_suite , "short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.sbit_1 , -1 , test_suite , "short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.sbit_2 , 2 , test_suite , "short bitfield" ) - - TRICK_EXPECT_EQ( ball.obj.usbit_0 , 2 , test_suite , "unsigned short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.usbit_1 , 31 , test_suite , "unsigned short bitfield" ) - TRICK_EXPECT_EQ( ball.obj.usbit_2 , 127 , test_suite , "unsigned short bitfield" ) - -###################################################################################################################### - - ball.obj.bit_0 = 0 - trick.rti_add("ball.obj.bit_0", -1) - ball.obj.bit_1 = 0 - trick.rti_add("ball.obj.bit_1", 255) - ball.obj.bit_2 = 0 - trick.rti_add("ball.obj.bit_2", 2) - - ball.obj.ubit_0 = 0 - trick.rti_add("ball.obj.ubit_0", 2) - ball.obj.ubit_1 = 0 - trick.rti_add("ball.obj.ubit_1", 255) - ball.obj.ubit_2 = 0 - trick.rti_add("ball.obj.ubit_2", -1) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.bit_0 , -1 , test_suite , "int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.bit_1 , -1 , test_suite , "int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.bit_2 , 2 , test_suite , "int bitfield" ) - - TRICK_EXPECT_EQ( ball.obj.ubit_0 , 2 , test_suite , "unsigned int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ubit_1 , 31 , test_suite , "unsigned int bitfield" ) - TRICK_EXPECT_EQ( ball.obj.ubit_2 , 63 , test_suite , "unsigned int bitfield" ) - -###################################################################################################################### - - # long and long long bitfields are not currently supported by - # sim_services/MemoryManager/src/insert_bitfield_any.c - - #ball.obj.lbit_0 = 0 - #trick.rti_add("ball.obj.lbit_0", -1) - #ball.obj.lbit_1 = 0 - #trick.rti_add("ball.obj.lbit_1", 255) - #ball.obj.lbit_2 = 0 - #trick.rti_add("ball.obj.lbit_2", 2) - - #ball.obj.ulbit_0 = 0 - #trick.rti_add("ball.obj.ulbit_0", 2) - #ball.obj.ulbit_1 = 0 - #trick.rti_add("ball.obj.ulbit_1", 255) - #ball.obj.ulbit_2 = 0 - #trick.rti_add("ball.obj.ulbit_2", -1) - - #trick.rti_fire() - #trick_inject.rtis.GetRtiExecutor(0).Exec() - - #TRICK_EXPECT_EQ( ball.obj.lbit_0 , -1 , test_suite , "long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.lbit_1 , -1 , test_suite , "long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.lbit_2 , 2 , test_suite , "long bitfield" ) - - #TRICK_EXPECT_EQ( ball.obj.ulbit_0 , 2 , test_suite , "unsigned long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.ulbit_1 , 31 , test_suite , "unsigned long bitfield" ) - #TRICK_EXPECT_EQ( ball.obj.ulbit_2 , 63 , test_suite , "unsigned long bitfield" ) - -###################################################################################################################### - - ball.obj.boolbit_0 = 0 - trick.rti_add("ball.obj.boolbit_0", 2) - ball.obj.boolbit_1 = 0 - trick.rti_add("ball.obj.boolbit_1", 1) - ball.obj.boolbit_2 = 0 - trick.rti_add("ball.obj.boolbit_2", 255) - - trick.rti_fire() - trick_inject.rtis.GetRtiExecutor(0).Exec() - - TRICK_EXPECT_EQ( ball.obj.boolbit_0 , 0 , test_suite , "bool bitfield" ) - TRICK_EXPECT_EQ( ball.obj.boolbit_1 , 1 , test_suite , "bool bitfield" ) - TRICK_EXPECT_EQ( ball.obj.boolbit_2 , 1 , test_suite , "bool bitfield" ) - -###################################################################################################################### - -if __name__ == "__main__": - - main() - diff --git a/trick_sims/SIM_rti/S_define b/trick_sims/SIM_rti/S_define deleted file mode 100644 index 24df9b29..00000000 --- a/trick_sims/SIM_rti/S_define +++ /dev/null @@ -1,100 +0,0 @@ -/************************TRICK HEADER************************* -PURPOSE: - (This comment lists out the other object files that are not included from c++ headers) -LIBRARY DEPENDENCIES: - ( - ) -*************************************************************/ - -#include "sim_objects/default_trick_sys.sm" - -##include "test_ip/include/Ball_test.hh" - -/* base ball... get it? :) */ -class ballSimObject : public Trick::SimObject { - - public: - Ball_alex obj ; - TEST_STRUCT t ; - my_ns::AA ns_test ; - - ballSimObject() { - ("default_data") obj.force.default_data() ; - ("default_data") obj.state.default_data() ; - - ("initialization") obj.state_init() ; - - ("derivative") obj.force_field() ; - ("derivative") obj.state_deriv() ; - ("integration") trick_ret = obj.state_integ() ; - - (10.0, "scheduled") trick_ret = obj.state_print() ; - - ("freeze") obj.state_print() ; - } - - private: - ballSimObject (const ballSimObject &); - ballSimObject & operator= (const ballSimObject &); - -} ; - -class disabledSimObject : public Trick::SimObject { - public: - void print_me() { - message_publish( 7 , "\033[31mThis statement in disabledSimObject should not print because the sim object is disabled!!!\033[0m\n" ) ; - add_test_result( "IPtest" , "Disable sim_object" , "job not disabled\n") ; - } - disabledSimObject() { - ("initialization") print_me() ; - (10.0 , "scheduled") print_me() ; - } -} ; - -class emptySimObject : public Trick::SimObject { - - public: - Ball_alex obj ; - - private: - emptySimObject (const emptySimObject &); - emptySimObject & operator= (const emptySimObject &); - -} ; - -class reallyemptySimObject : public Trick::SimObject { - public: - int ii ; -} ; - -class plainClass { - public: - double d ; - float f ; - plainClass() : d() , f() {} ; -} - -// Instantiations -ballSimObject ball ; -disabledSimObject disabled_obj ; - -// This collect can now be done in create_connections or the input file. -//collect ball.obj.state.work.external_force = {ball.obj.force.output.force[0]}; - -IntegLoop my_integ_loop (0.01) ball; - -// Connect objects -void create_connections() { - - // Set the default termination time - trick_sys.sched.set_terminate_time(300.0) ; - trick_sys.sched.set_freeze_frame(0.10) ; - - - my_integ_loop.getIntegrator( Runge_Kutta_2, 4 ); - - // Example of adding a collect in create_connections. - ball.obj.state.add_external_force( ball.obj.force.output.force ) ; - -} - diff --git a/trick_sims/SIM_rti/S_overrides.mk b/trick_sims/SIM_rti/S_overrides.mk deleted file mode 100644 index 8f6cee7e..00000000 --- a/trick_sims/SIM_rti/S_overrides.mk +++ /dev/null @@ -1,4 +0,0 @@ -TRICK_ICG_EXCLUDE=${TRICK_HOME}/trick_models/exclude_me -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models - diff --git a/trick_sims/SIM_test_ip/RUN_test/unit_test.py b/trick_sims/SIM_test_ip/RUN_test/unit_test.py deleted file mode 100644 index 85ba0621..00000000 --- a/trick_sims/SIM_test_ip/RUN_test/unit_test.py +++ /dev/null @@ -1,2995 +0,0 @@ - -import math -from trick.unit_test import * - -def main(): - - my_integ_loop.getIntegrator( trick.Runge_Kutta_2, 4 ); - - # These are here as a reference for the add_collect syntax... I have changed the code to not use collect - # An example of removing collect in the input file (original collect added in S_define file) - #ball.obj.state.work.external_force = trick.delete_collect(ball.obj.state.work.external_force, ball.obj.force.output.force) - # An example of adding a collect in the input file - #ball.obj.state.work.external_force = trick.add_collect(ball.obj.state.work.external_force, ball.obj.force.output.force) - - # An example of turning off a sim_object - trick.exec_set_sim_object_onoff("disabled_obj" , False) - - trick.exec_set_terminate_time(1.0) - - trick_utest.unit_tests.enable() - trick_utest.unit_tests.set_file_name( os.getenv("TRICK_HOME") + "/trick_test/SIM_test_ip.xml" ) - trick_utest.unit_tests.set_test_name( "IPtest" ) - -###################################################################################################################### - - test_suite = "double" - - ball.obj.d = 2 - TRICK_EXPECT_NEAR( ball.obj.d , 2.0 , 0.000001 , test_suite , "no units" ) - trick.trick_test_add_parent( test_suite , "no units" , "910635102") - - ball.obj.d = trick.attach_units("lbm" , 2) - TRICK_EXPECT_NEAR( ball.obj.d , 0.907185 , 0.000001 , test_suite , "units convert" ) - - ball.obj.da = [ 20 , 21 , 22 ] - TRICK_EXPECT_NEAR( ball.obj.da[0] , 20 , 0.000001 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.da[1] , 21 , 0.000001 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.da[2] , 22 , 0.000001 , test_suite , "1D array, integer value, no units" ) - - ball.obj.da = [ 30.1 , 31.1 , 32.1 ] - - TRICK_EXPECT_NEAR( ball.obj.da[0] , 30.1 , 0.000001 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.da[1] , 31.1 , 0.000001 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.da[2] , 32.1 , 0.000001 , test_suite , "1D array, float value, no units" ) - - ball.obj.da = 40.1 , 41.1 , 42.1 - - TRICK_EXPECT_NEAR( ball.obj.da[0] , 40.1 , 0.000001 , test_suite , "1D array, tuple float value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.da[1] , 41.1 , 0.000001 , test_suite , "1D array, tuple float value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.da[2] , 42.1 , 0.000001 , test_suite , "1D array, tuple float value, no units" ) - - ball.obj.da = trick.attach_units("lbm" , [2 , 3 , 4]) - TRICK_EXPECT_NEAR( ball.obj.da[0] , 0.907185 , 0.000001 , test_suite , "1D array, float value, units convert" ) - TRICK_EXPECT_NEAR( ball.obj.da[1] , 1.36078 , 0.00001 , test_suite , "1D array, float value, units convert" ) - TRICK_EXPECT_NEAR( ball.obj.da[2] , 1.81437 , 0.00001 , test_suite , "1D array, float value, units convert" ) - - ball.obj.dp = trick.TMM_declare_var_s("double[6]") - TRICK_EXPECT_NEAR( ball.obj.dp[0] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_NEAR( ball.obj.dp[5] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "1D ptr, allocation" ) - - ball.obj.dp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[30 kg, 31 kg, 32 kg, 33 kg]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.dp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[30 kg, 31 kg, 62 kg, 33 kg]", test_suite , "1D ptr, partial assign, no units" ) - - TRICK_EXPECT_EQ( ball.obj.dp[-1], 33, test_suite , "negative index integer value" ) - TRICK_EXPECT_EQ( ball.obj.dp[-1.0], 33, test_suite , "negative index float value" ) - - ball.obj.dp[-1] = 55 - ball.obj.dp[-2] = 54 - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[30 kg, 31 kg, 54 kg, 55 kg]", test_suite , "negative index assignments" ) - - ball.obj.dp = None - TRICK_EXPECT_EQ( str(ball.obj.dp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - # Mixed tuple/list notation - ball.obj.daa = trick.attach_units( "kg", (( 50 , 51 , 52) , [53, 54, 55]) ) - TRICK_EXPECT_EQ( str(ball.obj.daa) , "[[50 kg, 51 kg, 52 kg],[53 kg, 54 kg, 55 kg]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.daa = trick.attach_units( "kg", [[ 40 , 41 , 42] , [43, 44, 45]] ) - TRICK_EXPECT_EQ( str(ball.obj.daa) , "[[40 kg, 41 kg, 42 kg],[43 kg, 44 kg, 45 kg]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.daa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.daa) , "[[40 kg, 41 kg, 42 kg],[50 kg, 51 kg, 52 kg]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.daa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.daa) , "[[40 kg, 41 kg, 42 kg],[50.1 kg, 51.2 kg, 52.3 kg]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.daa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.daa) , "[[40 kg, 41 kg, 42 kg],[50.1 kg, 60 kg, 52.3 kg]]", - test_suite , "2D array, single assign, no units" ) - - ball.obj.daa[0] = trick.attach_units( "lbm",[ 4.0, 5.0, 6.0]) - TRICK_EXPECT_EQ( str(ball.obj.daa[0]) , "[1.814369479104077 kg, 2.267961848880096 kg, 2.721554218656115 kg]", - test_suite , "2D array, single single row assignment with units conversion" ) - - TRICK_EXPECT_EQ( str(ball.obj.dap) , "[NULL, NULL, NULL, NULL]", test_suite , "2D array of ptr, initial value" ) - - ball.obj.dap[0] = trick.TMM_declare_var_1d( "double", 3) - ball.obj.dap[1] = trick.TMM_declare_var_1d( "double", 4) - ball.obj.dap[2] = trick.TMM_declare_var_1d( "double", 5) - ball.obj.dap[3] = trick.TMM_declare_var_1d( "double", 6) - - TRICK_EXPECT_EQ( str(ball.obj.dap[0]) , "[0 kg, 0 kg, 0 kg]", test_suite , "2D array of ptr, single row access" ) - - ball.obj.dap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.dap[3]) , "[60 kg, 61 kg, 62 kg, 63 kg]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.dap[3][1] = 75 - ball.obj.dap[3][3] = trick.attach_units("lbm", float(ball.obj.dap[3][3]) + 1.0) - - TRICK_EXPECT_EQ( str(ball.obj.dap[3]) , "[60 kg, 75 kg, 62 kg, 29.02991166566523 kg]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.dpp = trick.TMM_declare_var_s("double *[4]") - TRICK_EXPECT_EQ( str(ball.obj.dpp) , "[NULL, NULL, NULL, NULL]", test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.dpp[0] = trick.TMM_declare_var_1d( "double", 5) - TRICK_EXPECT_EQ( str(ball.obj.dpp[0]) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.dpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.dpp[0]) , "[0 kg, 85 kg, 0 kg, 0 kg, 0 kg]", - test_suite , "2D ptr of ptr, scalar assignment" ) - - ball.obj.dpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.dpp[1]) , "[91 kg, 92 kg, 93 kg]", - test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.dpp[2] = trick.attach_units("lbm" , [ 91 , 92 , 93 , 94 , 95]) - TRICK_EXPECT_NEAR( ball.obj.dpp[2][0] , 41.276905 , 0.000001 , - test_suite , "2D ptr of ptr, united value" ) - - ball.obj.dpp = None - TRICK_EXPECT_EQ( str(ball.obj.dpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - - ball.obj.daaa[0][0] = [1, 2, 3, 4] - ball.obj.daaa[0][1] = [5, 6, 7, 8] - ball.obj.daaa[0][2][0] = 9 - ball.obj.daaa[0][2][1] = 10 - ball.obj.daaa[0][2][2] = 11 - ball.obj.daaa[0][2][3] = 12 - # 2D assignment fails with error message but does not exit sim. :( - #ball.obj.daaa[1][0] = [[101, 102, 103, 104] , [105, 106, 107, 108] , [109, 110, 111, 112]] - TRICK_EXPECT_EQ( str(ball.obj.daaa[0]) , "[[1 kg, 2 kg, 3 kg, 4 kg],[5 kg, 6 kg, 7 kg, 8 kg],[9 kg, 10 kg, 11 kg, 12 kg]]", - test_suite , "3D array, list and scalar assignment" ) - - # 4D assignment array is not supported yet - #ball.obj.daaaa[0][0][0] = [51, 52, 53, 54, 55] - -###################################################################################################################### - - test_suite = "float" - - ball.obj.f = 2 - TRICK_EXPECT_NEAR( ball.obj.f , 2.0 , 0.000001 , test_suite , "no units" ) - trick.trick_test_add_parent( test_suite , "no units" , "1532242077") - - ball.obj.f = trick.attach_units("lbm" , 2) - TRICK_EXPECT_NEAR( ball.obj.f , 0.907185 , 0.000001 , test_suite , "units convert" ) - - ball.obj.fa = [ 20 , 21 , 22 ] - TRICK_EXPECT_NEAR( ball.obj.fa[0] , 20 , 0.000001 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.fa[1] , 21 , 0.000001 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.fa[2] , 22 , 0.000001 , test_suite , "1D array, integer value, no units" ) - - ball.obj.fa = [ 30.1 , 31.1 , 32.1 ] - - TRICK_EXPECT_NEAR( ball.obj.fa[0] , 30.1 , 0.0001 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.fa[1] , 31.1 , 0.0001 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_NEAR( ball.obj.fa[2] , 32.1 , 0.0001 , test_suite , "1D array, float value, no units" ) - - ball.obj.fa = trick.attach_units("lbm" , [2 , 3 , 4]) - TRICK_EXPECT_NEAR( ball.obj.fa[0] , 0.907185 , 0.000001 , test_suite , "1D array, float value, units convert" ) - TRICK_EXPECT_NEAR( ball.obj.fa[1] , 1.36078 , 0.00001 , test_suite , "1D array, float value, units convert" ) - TRICK_EXPECT_NEAR( ball.obj.fa[2] , 1.81437 , 0.00001 , test_suite , "1D array, float value, units convert" ) - - ball.obj.fp = trick.alloc_type( 6 , "float") - TRICK_EXPECT_NEAR( ball.obj.fp[0] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_NEAR( ball.obj.fp[5] , 0 , 0.00001 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.fp) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "1D ptr, allocation" ) - - ball.obj.fp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.fp) , "[30 kg, 31 kg, 32 kg, 33 kg]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.fp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.fp) , "[30 kg, 31 kg, 62 kg, 33 kg]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.fp = None - TRICK_EXPECT_EQ( str(ball.obj.fp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.faa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.faa) , "[[40 kg, 41 kg, 42 kg],[43 kg, 44 kg, 45 kg]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.faa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.faa) , "[[40 kg, 41 kg, 42 kg],[50 kg, 51 kg, 52 kg]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.faa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.faa) , "[[40 kg, 41 kg, 42 kg],[50.099998 kg, 51.200001 kg, 52.299999 kg]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.faa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.faa) , "[[40 kg, 41 kg, 42 kg],[50.099998 kg, 60 kg, 52.299999 kg]]", - test_suite , "2D array, partial assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.fap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.fap[0] = trick.alloc_type( 3 , "float") - ball.obj.fap[1] = trick.alloc_type( 4 , "float") - ball.obj.fap[2] = trick.alloc_type( 5 , "float") - ball.obj.fap[3] = trick.alloc_type( 6 , "float") - TRICK_EXPECT_EQ( str(ball.obj.fap[0]) , "[0 kg, 0 kg, 0 kg]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.fap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.fap[3]) , "[60 kg, 61 kg, 62 kg, 63 kg]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.fap[3][1] = 75 - ball.obj.fap[3][3] = trick.attach_units("lbm", float(ball.obj.fap[3][3]) + 1.0) - - TRICK_EXPECT_EQ( str(ball.obj.fap[3]) , "[60 kg, 75 kg, 62 kg, 29.029911 kg]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.fpp = trick.alloc_type( 4 , "float *") - TRICK_EXPECT_EQ( str(ball.obj.fpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.fpp[0] = trick.alloc_type( 5 , "float") - TRICK_EXPECT_EQ( str(ball.obj.fpp[0]) , "[0 kg, 0 kg, 0 kg, 0 kg, 0 kg]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.fpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.fpp[0]) , "[0 kg, 85 kg, 0 kg, 0 kg, 0 kg]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.fpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.fpp[1]) , "[91 kg, 92 kg, 93 kg]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.fpp = None - TRICK_EXPECT_EQ( str(ball.obj.fpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - - ball.obj.f_rad = 2.0 - TRICK_EXPECT_NEAR( ball.obj.f_rad , 2.0 , 0.000001 , test_suite , "no units" ) - - ball.obj.f_rad = trick.attach_units("d" , 45.0) - TRICK_EXPECT_NEAR( ball.obj.f_rad , 0.785398 , 0.000001 , test_suite , "unit conv" ) - - ball.obj.d_deg = ball.obj.f_rad - TRICK_EXPECT_NEAR( ball.obj.d_deg , 45.0 , 0.00001 , test_suite , "value to value assign with conversion" ) - -###################################################################################################################### - - test_suite = "char" - - ball.obj.c = 'g' - TRICK_EXPECT_EQ( str(ball.obj.c) , "103", test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "2896569040") - - ball.obj.c = 123 - TRICK_EXPECT_EQ( str(ball.obj.c) , "123", test_suite , "assignment" ) - - ball.obj.ca = "Trick is great" - TRICK_EXPECT_EQ( str(ball.obj.ca) , "Trick is great", test_suite , "arrray assignment" ) - - ball.obj.ca = [65, 66, 67, 68, 69] - TRICK_EXPECT_EQ( str(ball.obj.ca) , "ABCDE", test_suite , "arrray assignment" ) - - ball.obj.ca = [65.1, 66.2, 67.3, 68.4, 69.6] - TRICK_EXPECT_EQ( str(ball.obj.ca) , "ABCDE", test_suite , "arrray assignment" ) - TRICK_EXPECT_EQ( ball.obj.ca[3] , 68 , test_suite , "arrray assignment" ) - - ball.obj.cp = trick.alloc_type( 6 , "char") - TRICK_EXPECT_EQ( ball.obj.cp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.cp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.cp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.cp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.cp) , "[30, 31, ' ', '!']", test_suite , "float 1D ptr, list assign, no units" ) - - ball.obj.cp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.cp) , "[30, 31, '>', '!']", test_suite , "float 1D ptr, partial assign, no units" ) - - - ball.obj.cp = "testing" - TRICK_EXPECT_EQ( str(ball.obj.cp) , "testing", test_suite , "ptr assignment" ) - - ball.obj.cp = None - TRICK_EXPECT_EQ( str(ball.obj.cp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.caa = [ "abcdefg" , "hijklmn" ] - TRICK_EXPECT_EQ( str(ball.obj.caa) , "[\"abcdefg\",\"hijklmn\",[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", test_suite , "2D array string assignment" ) - TRICK_EXPECT_EQ( str(ball.obj.caa[1]) , "hijklmn", test_suite , "2D array item access" ) - TRICK_EXPECT_EQ( ball.obj.caa[1][4] , 108, test_suite , "2D array single char access" ) - - TRICK_EXPECT_EQ( str(ball.obj.cap) , """[NULL, NULL, NULL, NULL]""", test_suite , "2D array of ptr initial value" ) - - ball.obj.cap[0] = "cap0" - ball.obj.cap[1] = "cap1" - ball.obj.cap[2] = "cap2" - ball.obj.cap[3] = "cap3" - TRICK_EXPECT_EQ( str(ball.obj.cap) , "[\"cap0\", \"cap1\", \"cap2\", \"cap3\"]", test_suite , "2D array of ptr single item assignment" ) - TRICK_EXPECT_EQ( str(ball.obj.cap[0]) , "cap0", test_suite , "2D array of ptr single item assignment" ) - - TRICK_EXPECT_EQ( ball.obj.cap[3][2] , 112 , test_suite , "2D array of ptr single item assignment" ) - - ball.obj.cpp = trick.alloc_type( 4 , "char *") - TRICK_EXPECT_EQ( str(ball.obj.cpp) , """[NULL, NULL, NULL, NULL]""", test_suite , "2D ptr of ptr initial value" ) - - ball.obj.cpp[0] = "cpp_string_0" - ball.obj.cpp[1] = "cpp_string_1" - ball.obj.cpp[2] = "cpp_string_2" - ball.obj.cpp[3] = "cpp_string_3" - TRICK_EXPECT_EQ( str(ball.obj.cpp[2]) , "cpp_string_2", test_suite , "2D ptr of ptr single string access" ) - TRICK_EXPECT_EQ( ball.obj.cpp[2][3] , 95 , test_suite , "2D ptr of ptr single character access" ) - - ball.obj.cpp = None - TRICK_EXPECT_EQ( str(ball.obj.cpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "unsigned char" - - ball.obj.uc = 95 - TRICK_EXPECT_EQ( ball.obj.uc , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "219444977") - - ball.obj.uc += 1 - TRICK_EXPECT_EQ( ball.obj.uc , 96 , test_suite , "increment" ) - - ball.obj.uc = ball.obj.uc + 1 - TRICK_EXPECT_EQ( ball.obj.uc , 97 , test_suite , "increment" ) - - ball.obj.uc = 1 + ball.obj.uc - TRICK_EXPECT_EQ( ball.obj.uc , 98 , test_suite , "increment" ) - - ball.obj.uca = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.uca[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uca[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uca[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.uca = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.uca[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uca[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uca[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.ucp = trick.alloc_type( 6 , "unsigned char") - TRICK_EXPECT_EQ( ball.obj.ucp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.ucp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.ucp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.ucp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.ucp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.ucp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.ucp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.ucp = None - TRICK_EXPECT_EQ( str(ball.obj.ucp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.ucaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.ucaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.ucaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.ucaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.ucaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.ucaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.ucaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.ucaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.ucap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.ucap[0] = trick.alloc_type( 3 , "unsigned char") - ball.obj.ucap[1] = trick.alloc_type( 4 , "unsigned char") - ball.obj.ucap[2] = trick.alloc_type( 5 , "unsigned char") - ball.obj.ucap[3] = trick.alloc_type( 6 , "unsigned char") - - TRICK_EXPECT_EQ( str(ball.obj.ucap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.ucap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.ucap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.ucap[3][1] = 75 - ball.obj.ucap[3][3] = trick.attach_units("--", int(ball.obj.ucap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.ucap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.ucpp = trick.alloc_type( 4 , "unsigned char *") - TRICK_EXPECT_EQ( str(ball.obj.ucpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.ucpp[0] = trick.alloc_type( 5 , "unsigned char") - TRICK_EXPECT_EQ( str(ball.obj.ucpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.ucpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.ucpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.ucpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.ucpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.ucpp = None - TRICK_EXPECT_EQ( str(ball.obj.ucpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "short" - - ball.obj.s = 95 - TRICK_EXPECT_EQ( ball.obj.s , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "2880907803") - - ball.obj.s += 1 - TRICK_EXPECT_EQ( ball.obj.s , 96 , test_suite , "increment" ) - - ball.obj.s = ball.obj.s + 1 - TRICK_EXPECT_EQ( ball.obj.s , 97 , test_suite , "increment" ) - - ball.obj.s = 1 + ball.obj.s - TRICK_EXPECT_EQ( ball.obj.s , 98 , test_suite , "increment" ) - - ball.obj.sa = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.sa[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.sa[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.sa[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.sa = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.sa[0] , 30 , test_suite , "short 1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.sa[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.sa[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.sp = trick.alloc_type( 6 , "short") - TRICK_EXPECT_EQ( ball.obj.sp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.sp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.sp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.sp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.sp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.sp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.sp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.sp = None - TRICK_EXPECT_EQ( str(ball.obj.sp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.saa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.saa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.saa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.saa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.saa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.saa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.saa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.saa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.sap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.sap[0] = trick.alloc_type( 3 , "short") - ball.obj.sap[1] = trick.alloc_type( 4 , "short") - ball.obj.sap[2] = trick.alloc_type( 5 , "short") - ball.obj.sap[3] = trick.alloc_type( 6 , "short") - - TRICK_EXPECT_EQ( str(ball.obj.sap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.sap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.sap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.sap[3][1] = 75 - ball.obj.sap[3][3] = trick.attach_units("--", int(ball.obj.sap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.sap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.spp = trick.alloc_type( 4 , "short *") - TRICK_EXPECT_EQ( str(ball.obj.spp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.spp[0] = trick.alloc_type( 5 , "short") - TRICK_EXPECT_EQ( str(ball.obj.spp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.spp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.spp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.spp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.spp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.spp = None - TRICK_EXPECT_EQ( str(ball.obj.spp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "unsigned short" - - ball.obj.us = 95 - TRICK_EXPECT_EQ( ball.obj.us , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "217750348") - - ball.obj.us += 1 - TRICK_EXPECT_EQ( ball.obj.us , 96 , test_suite , "increment" ) - - ball.obj.us = ball.obj.us + 1 - TRICK_EXPECT_EQ( ball.obj.us , 97 , test_suite , "increment" ) - - ball.obj.us = 1 + ball.obj.us - TRICK_EXPECT_EQ( ball.obj.us , 98 , test_suite , "increment" ) - - ball.obj.usa = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.usa[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.usa[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.usa[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.usa = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.usa[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.usa[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.usa[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.usp = trick.alloc_type( 6 , "unsigned short") - TRICK_EXPECT_EQ( ball.obj.usp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.usp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.usp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.usp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.usp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.usp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.usp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.usp = None - TRICK_EXPECT_EQ( str(ball.obj.usp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.usaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.usaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.usaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.usaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.usaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.usaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.usaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.usaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.usap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.usap[0] = trick.alloc_type( 3 , "unsigned short") - ball.obj.usap[1] = trick.alloc_type( 4 , "unsigned short") - ball.obj.usap[2] = trick.alloc_type( 5 , "unsigned short") - ball.obj.usap[3] = trick.alloc_type( 6 , "unsigned short") - - TRICK_EXPECT_EQ( str(ball.obj.usap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.usap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.usap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.usap[3][1] = 75 - ball.obj.usap[3][3] = trick.attach_units("--", int(ball.obj.usap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.usap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.uspp = trick.alloc_type( 4 , "unsigned short *") - TRICK_EXPECT_EQ( str(ball.obj.uspp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.uspp[0] = trick.alloc_type( 5 , "unsigned short") - TRICK_EXPECT_EQ( str(ball.obj.uspp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.uspp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.uspp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.uspp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.uspp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.uspp = None - TRICK_EXPECT_EQ( str(ball.obj.uspp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "enum" - - ball.obj.e = trick.THIRD - TRICK_EXPECT_EQ( ball.obj.e , trick.THIRD , test_suite , "scalar, integer value, no units" ) - trick.trick_test_add_parent( test_suite , "scalar, integer value, no units" , "3331066868") - - ball.obj.ea = [ trick.THIRD , trick.SECOND , trick.FIRST ] - TRICK_EXPECT_EQ( ball.obj.ea[0] , trick.THIRD , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ea[1] , trick.SECOND , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ea[2] , trick.FIRST , test_suite , "1D array, integer value, no units" ) - - ball.obj.ea[1] = trick.THIRD - ball.obj.ea[2] = trick.SECOND - TRICK_EXPECT_EQ( ball.obj.ea[1] , trick.THIRD , test_suite , "1D array single value assignment" ) - TRICK_EXPECT_EQ( ball.obj.ea[2] , trick.SECOND , test_suite , "1D array single value assignment" ) - - ball.obj.ep = trick.alloc_type( 6 , "MY_ENUM") - TRICK_EXPECT_EQ( ball.obj.ep[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.ep[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.ep) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.ep = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.ep) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.ep[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.ep) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.ep = None - TRICK_EXPECT_EQ( str(ball.obj.ep) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.eaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.eaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.eaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.eaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.eaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.eaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.eaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.eaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.eap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.eap[0] = trick.alloc_type( 3 , "MY_ENUM") - ball.obj.eap[1] = trick.alloc_type( 4 , "MY_ENUM") - ball.obj.eap[2] = trick.alloc_type( 5 , "MY_ENUM") - ball.obj.eap[3] = trick.alloc_type( 6 , "MY_ENUM") - - TRICK_EXPECT_EQ( str(ball.obj.eap[0]) , "[0, 0, 0]", test_suite , "2D array of ptr, single row access" ) - - ball.obj.eap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.eap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.eap[3][1] = 75 - ball.obj.eap[3][3] = trick.attach_units("--", int(ball.obj.eap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.eap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.epp = trick.alloc_type( 4 , "MY_ENUM *") - TRICK_EXPECT_EQ( str(ball.obj.epp) , "[NULL, NULL, NULL, NULL]", - test_suite , "int 2D ptr of ptr, initial value" ) - - ball.obj.epp[0] = trick.alloc_type( 5 , "MY_ENUM") - TRICK_EXPECT_EQ( str(ball.obj.epp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.epp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.epp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.epp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.epp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.epp = None - TRICK_EXPECT_EQ( str(ball.obj.epp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "int" - - ball.obj.i = 95 - TRICK_EXPECT_EQ( ball.obj.i , 95 , test_suite , "assignment" ) - #print "ball.obj.i = " , ball.obj.i - trick.trick_test_add_parent( test_suite , "assignment" , "3074788233") - - ball.obj.i += 1 - TRICK_EXPECT_EQ( ball.obj.i , 96 , test_suite , "increment" ) - - ball.obj.i = ball.obj.i + 1 - TRICK_EXPECT_EQ( ball.obj.i , 97 , test_suite , "increment" ) - - ball.obj.i = 1 + ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 98 , test_suite , "increment" ) - - ball.obj.ia = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.ia[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ia[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ia[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.ia = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.ia[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ia[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ia[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.ia = trick.attach_units("--" , [60, 70]) - TRICK_EXPECT_EQ( ball.obj.ia[0] , 60 , test_suite , "1D array, -- units" ) - TRICK_EXPECT_EQ( ball.obj.ia[1] , 70 , test_suite , "1D array, -- units" ) - - ball.obj.ip = trick.alloc_type( 6 , "int") - TRICK_EXPECT_EQ( ball.obj.ip[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.ip[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.ip) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.ip = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.ip) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.ip[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.ip) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.ip = trick.attach_units("--" , [60, 70]) - TRICK_EXPECT_EQ( str(ball.obj.ip) , "[60, 70]", test_suite , "1D ptr, assign list -- unit-ed values" ) - - ball.obj.ip = None - TRICK_EXPECT_EQ( str(ball.obj.ip) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.iaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.iaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.iaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.iaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.iaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.iaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.iaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.iaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.iap) , "[NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.iap[0] = trick.alloc_type( 3 , "int") - ball.obj.iap[1] = trick.alloc_type( 4 , "int") - ball.obj.iap[2] = trick.alloc_type( 5 , "int") - ball.obj.iap[3] = trick.alloc_type( 6 , "int") - TRICK_EXPECT_EQ( str(ball.obj.iap[0]) , "[0, 0, 0]", test_suite , "2D array of ptr, single row access" ) - - ball.obj.iap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.iap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.iap[3][1] = 75 - ball.obj.iap[3][3] = trick.attach_units("--", int(ball.obj.iap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.iap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.ipp = trick.alloc_type( 4 , "int *") - TRICK_EXPECT_EQ( str(ball.obj.ipp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.ipp[0] = trick.alloc_type( 5 , "int") - TRICK_EXPECT_EQ( str(ball.obj.ipp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.ipp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.ipp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.ipp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.ipp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.ipp = None - TRICK_EXPECT_EQ( str(ball.obj.ipp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "unsigned int" - - ball.obj.ui = 95 - TRICK_EXPECT_EQ( ball.obj.ui , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "1873736978") - - ball.obj.ui += 1 - TRICK_EXPECT_EQ( ball.obj.ui , 96 , test_suite , "increment" ) - - ball.obj.ui = ball.obj.ui + 1 - TRICK_EXPECT_EQ( ball.obj.ui , 97 , test_suite , "increment" ) - - ball.obj.ui = 1 + ball.obj.ui - TRICK_EXPECT_EQ( ball.obj.ui , 98 , test_suite , "increment" ) - - ball.obj.uia = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.uia[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uia[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uia[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.uia = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.uia[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uia[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.uia[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.uip = trick.alloc_type( 6 , "unsigned int") - TRICK_EXPECT_EQ( ball.obj.uip[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.uip[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.uip) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.uip = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.uip) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.uip[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.uip) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.uip = None - TRICK_EXPECT_EQ( str(ball.obj.uip) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.uiaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.uiaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.uiaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.uiaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.uiaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.uiaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.uiaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.uiaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.uiap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.uiap[0] = trick.alloc_type( 3 , "unsigned int") - ball.obj.uiap[1] = trick.alloc_type( 4 , "unsigned int") - ball.obj.uiap[2] = trick.alloc_type( 5 , "unsigned int") - ball.obj.uiap[3] = trick.alloc_type( 6 , "unsigned int") - - TRICK_EXPECT_EQ( str(ball.obj.uiap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.uiap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.uiap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.uiap[3][1] = 75 - ball.obj.uiap[3][3] = trick.attach_units("--", int(ball.obj.uiap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.uiap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.uipp = trick.alloc_type( 4 , "unsigned int *") - TRICK_EXPECT_EQ( str(ball.obj.uipp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.uipp[0] = trick.alloc_type( 5 , "unsigned int") - TRICK_EXPECT_EQ( str(ball.obj.uipp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.uipp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.uipp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.uipp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.uipp[1]) , "[91, 92, 93]", test_suite , "unsigned int 2D ptr of ptr, row assignment" ) - - ball.obj.uipp = None - TRICK_EXPECT_EQ( str(ball.obj.uipp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "long" - - ball.obj.l = 95 - TRICK_EXPECT_EQ( ball.obj.l , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "3338288463") - - ball.obj.l += 1 - TRICK_EXPECT_EQ( ball.obj.l , 96 , test_suite , "increment" ) - - ball.obj.l = ball.obj.l + 1 - TRICK_EXPECT_EQ( ball.obj.l , 97 , test_suite , "increment" ) - - ball.obj.l = 1 + ball.obj.l - TRICK_EXPECT_EQ( ball.obj.l , 98 , test_suite , "increment" ) - - ball.obj.la = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.la[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.la[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.la[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.la = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.la[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.la[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.la[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.lp = trick.alloc_type( 6 , "long") - TRICK_EXPECT_EQ( ball.obj.lp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.lp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.lp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.lp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.lp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.lp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.lp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.lp = None - TRICK_EXPECT_EQ( str(ball.obj.lp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.laa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.laa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.laa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.laa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.laa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.laa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.laa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.laa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.lap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.lap[0] = trick.alloc_type( 3 , "long") - ball.obj.lap[1] = trick.alloc_type( 4 , "long") - ball.obj.lap[2] = trick.alloc_type( 5 , "long") - ball.obj.lap[3] = trick.alloc_type( 6 , "long") - - TRICK_EXPECT_EQ( str(ball.obj.lap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.lap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.lap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.lap[3][1] = 75 - ball.obj.lap[3][3] = trick.attach_units("--", int(ball.obj.lap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.lap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.lpp = trick.alloc_type( 4 , "long *") - TRICK_EXPECT_EQ( str(ball.obj.lpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.lpp[0] = trick.alloc_type( 5 , "long") - TRICK_EXPECT_EQ( str(ball.obj.lpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.lpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.lpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.lpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.lpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.lpp = None - TRICK_EXPECT_EQ( str(ball.obj.lpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "unsinged long" - - ball.obj.ul = 95 - TRICK_EXPECT_EQ( ball.obj.ul , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "2844151852") - - ball.obj.ul += 1 - TRICK_EXPECT_EQ( ball.obj.ul , 96 , test_suite , "increment" ) - - ball.obj.ul = ball.obj.ul + 1 - TRICK_EXPECT_EQ( ball.obj.ul , 97 , test_suite , "increment" ) - - ball.obj.ul = 1 + ball.obj.ul - TRICK_EXPECT_EQ( ball.obj.ul , 98 , test_suite , "increment" ) - - ball.obj.ula = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.ula[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ula[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ula[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.ula = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.ula[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ula[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ula[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.ulp = trick.alloc_type( 6 , "unsigned long") - TRICK_EXPECT_EQ( ball.obj.ulp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.ulp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.ulp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.ulp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.ulp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.ulp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.ulp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.ulp = None - TRICK_EXPECT_EQ( str(ball.obj.ulp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.ulaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.ulaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.ulaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.ulaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.ulaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.ulaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.ulaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.ulaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.ulap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.ulap[0] = trick.alloc_type( 3 , "unsigned long") - ball.obj.ulap[1] = trick.alloc_type( 4 , "unsigned long") - ball.obj.ulap[2] = trick.alloc_type( 5 , "unsigned long") - ball.obj.ulap[3] = trick.alloc_type( 6 , "unsigned long") - - TRICK_EXPECT_EQ( str(ball.obj.ulap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.ulap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.ulap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.ulap[3][1] = 75 - ball.obj.ulap[3][3] = trick.attach_units("--", int(ball.obj.ulap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.ulap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.ulpp = trick.alloc_type( 4 , "unsigned long *") - TRICK_EXPECT_EQ( str(ball.obj.ulpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.ulpp[0] = trick.alloc_type( 5 , "unsigned long") - TRICK_EXPECT_EQ( str(ball.obj.ulpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.ulpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.ulpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.ulpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.ulpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.ulpp = None - TRICK_EXPECT_EQ( str(ball.obj.ulpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "long long" - - ball.obj.ll = 95 - TRICK_EXPECT_EQ( ball.obj.ll , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "2165977787") - - ball.obj.ll += 1 - TRICK_EXPECT_EQ( ball.obj.ll , 96 , test_suite , "increment" ) - - ball.obj.ll = ball.obj.ll + 1 - TRICK_EXPECT_EQ( ball.obj.ll , 97 , test_suite , "increment" ) - - ball.obj.ll = 1 + ball.obj.ll - TRICK_EXPECT_EQ( ball.obj.ll , 98 , test_suite , "increment" ) - - ball.obj.lla = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.lla[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.lla[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.lla[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.lla = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.lla[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.lla[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.lla[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.llp = trick.alloc_type( 6 , "long long") - TRICK_EXPECT_EQ( ball.obj.llp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.llp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.llp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.llp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.llp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.llp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.llp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.llp = None - TRICK_EXPECT_EQ( str(ball.obj.llp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.llaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.llaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.llaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.llaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.llaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.llaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.llaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.llaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.llap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.llap[0] = trick.alloc_type( 3 , "long long") - ball.obj.llap[1] = trick.alloc_type( 4 , "long long") - ball.obj.llap[2] = trick.alloc_type( 5 , "long long") - ball.obj.llap[3] = trick.alloc_type( 6 , "long long") - - TRICK_EXPECT_EQ( str(ball.obj.llap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.llap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.llap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.llap[3][1] = 75 - ball.obj.llap[3][3] = trick.attach_units("--", int(ball.obj.llap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.llap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.llpp = trick.alloc_type( 4 , "long long *") - TRICK_EXPECT_EQ( str(ball.obj.llpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.llpp[0] = trick.alloc_type( 5 , "long long") - TRICK_EXPECT_EQ( str(ball.obj.llpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.llpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.llpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.llpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.llpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.llpp = None - TRICK_EXPECT_EQ( str(ball.obj.llpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "unsigned long long" - - ball.obj.ull = 95 - TRICK_EXPECT_EQ( ball.obj.ull , 95 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "3783821020") - - ball.obj.ull += 1 - TRICK_EXPECT_EQ( ball.obj.ull , 96 , test_suite , "increment" ) - - ball.obj.ull = ball.obj.ull + 1 - TRICK_EXPECT_EQ( ball.obj.ull , 97 , test_suite , "increment" ) - - ball.obj.ull = 1 + ball.obj.ull - TRICK_EXPECT_EQ( ball.obj.ull , 98 , test_suite , "increment" ) - - ball.obj.ulla = [ 20 , 21 , 22 ] - TRICK_EXPECT_EQ( ball.obj.ulla[0] , 20 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ulla[1] , 21 , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ulla[2] , 22 , test_suite , "1D array, integer value, no units" ) - - ball.obj.ulla = [ 30.1 , 31.1 , 32.1 ] - TRICK_EXPECT_EQ( ball.obj.ulla[0] , 30 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ulla[1] , 31 , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ulla[2] , 32 , test_suite , "1D array, float value, no units" ) - - ball.obj.ullp = trick.alloc_type( 6 , "unsigned long long") - TRICK_EXPECT_EQ( ball.obj.ullp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.ullp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.ullp) , "[0, 0, 0, 0, 0, 0]", test_suite , "1D ptr, allocation" ) - - ball.obj.ullp = [ 30 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.ullp) , "[30, 31, 32, 33]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.ullp[2] = 62 - TRICK_EXPECT_EQ( str(ball.obj.ullp) , "[30, 31, 62, 33]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.ullp = None - TRICK_EXPECT_EQ( str(ball.obj.ullp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.ullaa = [[ 40 , 41 , 42] , [43, 44, 45]] - TRICK_EXPECT_EQ( str(ball.obj.ullaa) , "[[40, 41, 42],[43, 44, 45]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.ullaa[1] = [ 50 , 51 , 52] - TRICK_EXPECT_EQ( str(ball.obj.ullaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.ullaa[1] = [ 50.1 , 51.2 , 52.3 ] - TRICK_EXPECT_EQ( str(ball.obj.ullaa) , "[[40, 41, 42],[50, 51, 52]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.ullaa[1][1] = 60 - TRICK_EXPECT_EQ( str(ball.obj.ullaa) , "[[40, 41, 42],[50, 60, 52]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.ullap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.ullap[0] = trick.alloc_type( 3 , "unsigned long long") - ball.obj.ullap[1] = trick.alloc_type( 4 , "unsigned long long") - ball.obj.ullap[2] = trick.alloc_type( 5 , "unsigned long long") - ball.obj.ullap[3] = trick.alloc_type( 6 , "unsigned long long") - - TRICK_EXPECT_EQ( str(ball.obj.ullap[0]) , "[0, 0, 0]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.ullap[3] = [ 60 , 61 , 62, 63 ] - TRICK_EXPECT_EQ( str(ball.obj.ullap[3]) , "[60, 61, 62, 63]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.ullap[3][1] = 75 - ball.obj.ullap[3][3] = trick.attach_units("--", int(ball.obj.ullap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.ullap[3]) , "[60, 75, 62, 64]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.ullpp = trick.alloc_type( 4 , "unsigned long long *") - TRICK_EXPECT_EQ( str(ball.obj.ullpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.ullpp[0] = trick.alloc_type( 5 , "unsigned long long") - TRICK_EXPECT_EQ( str(ball.obj.ullpp[0]) , "[0, 0, 0, 0, 0]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.ullpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.ullpp[0]) , "[0, 85, 0, 0, 0]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.ullpp[1] = [ 91 , 92 , 93 ] - TRICK_EXPECT_EQ( str(ball.obj.ullpp[1]) , "[91, 92, 93]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.ullpp = None - TRICK_EXPECT_EQ( str(ball.obj.ullpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "bool" - - ball.obj.b = True - TRICK_EXPECT_EQ( ball.obj.b , True , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "4134211307") - - ball.obj.b += 1 - TRICK_EXPECT_EQ( ball.obj.b , True , test_suite , "increment" ) - - ball.obj.b = ball.obj.b + 1 - TRICK_EXPECT_EQ( ball.obj.b , True , test_suite , "increment" ) - - ball.obj.ull = 1 + ball.obj.ull - TRICK_EXPECT_EQ( ball.obj.b , True , test_suite , "increment" ) - - ball.obj.ba = [ False , True , True ] - TRICK_EXPECT_EQ( ball.obj.ba[0] , False , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ba[1] , True , test_suite , "1D array, integer value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ba[2] , True , test_suite , "1D array, integer value, no units" ) - - ball.obj.ba = [ 2.2 , 1.1 , 0 ] - TRICK_EXPECT_EQ( ball.obj.ba[0] , True , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ba[1] , True , test_suite , "1D array, float value, no units" ) - TRICK_EXPECT_EQ( ball.obj.ba[2] , False , test_suite , "1D array, float value, no units" ) - - ball.obj.bp = trick.alloc_type( 6 , "bool" ) - TRICK_EXPECT_EQ( ball.obj.bp[0] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( ball.obj.bp[5] , 0 , test_suite , "1D ptr, allocation" ) - TRICK_EXPECT_EQ( str(ball.obj.bp) , "[False, False, False, False, False, False]", test_suite , "1D ptr, allocation" ) - - ball.obj.bp = [ 0 , 31 , 32 , 33 ] - TRICK_EXPECT_EQ( str(ball.obj.bp) , "[False, True, True, True]", test_suite , "1D ptr, list assign, no units" ) - - ball.obj.bp[2] = 0 - TRICK_EXPECT_EQ( str(ball.obj.bp) , "[False, True, False, True]", test_suite , "1D ptr, partial assign, no units" ) - - ball.obj.bp = None - TRICK_EXPECT_EQ( str(ball.obj.bp) , "NULL", test_suite , "1D ptr None (NULL) assignment" ) - - ball.obj.baa = [[ 0 , 1 , 2] , [3, 4, 0]] - TRICK_EXPECT_EQ( str(ball.obj.baa) , "[[False, True, True],[True, True, False]]", - test_suite , "2D array, full assign, no units" ) - - ball.obj.baa[1] = [ False , False , True] - TRICK_EXPECT_EQ( str(ball.obj.baa) , "[[False, True, True],[False, False, True]]", - test_suite , "2D array, partial assign, no units" ) - - ball.obj.baa[1][1] = True - TRICK_EXPECT_EQ( str(ball.obj.baa) , "[[False, True, True],[False, True, True]]", - test_suite , "2D array, single assign, no units" ) - - TRICK_EXPECT_EQ( str(ball.obj.bap) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D array of ptr, initial value" ) - - ball.obj.bap[0] = trick.alloc_type( 3 , "bool") - ball.obj.bap[1] = trick.alloc_type( 4 , "bool") - ball.obj.bap[2] = trick.alloc_type( 5 , "bool") - ball.obj.bap[3] = trick.alloc_type( 6 , "bool") - - TRICK_EXPECT_EQ( str(ball.obj.bap[0]) , "[False, False, False]", - test_suite , "2D array of ptr, single row access" ) - - ball.obj.bap[3] = [ True , False , True, False ] - TRICK_EXPECT_EQ( str(ball.obj.bap[3]) , "[True, False, True, False]", - test_suite , "2D array of ptr, single row realloc and assignment" ) - - ball.obj.bap[3][1] = 75 - ball.obj.bap[3][3] = trick.attach_units("--", int(ball.obj.bap[3][3]) + 1) - - TRICK_EXPECT_EQ( str(ball.obj.bap[3]) , "[True, True, True, True]", - test_suite , "2D array of ptr, single item assignment with unit conversion" ) - - ball.obj.bpp = trick.alloc_type( 4 , "bool *") - TRICK_EXPECT_EQ( str(ball.obj.bpp) , "[NULL, NULL, NULL, NULL]", - test_suite , "2D ptr of ptr, initial value" ) - - ball.obj.bpp[0] = trick.alloc_type( 5 , "bool") - TRICK_EXPECT_EQ( str(ball.obj.bpp[0]) , "[False, False, False, False, False]", test_suite , "2D ptr of ptr, allocate 1 row" ) - - ball.obj.bpp[0][1] = 85 - TRICK_EXPECT_EQ( str(ball.obj.bpp[0]) , "[False, True, False, False, False]", test_suite , "2D ptr of ptr, assign 1 value" ) - - ball.obj.bpp[1] = [ True , False , True ] - TRICK_EXPECT_EQ( str(ball.obj.bpp[1]) , "[True, False, True]", test_suite , "2D ptr of ptr, row assignment" ) - - ball.obj.bpp = None - TRICK_EXPECT_EQ( str(ball.obj.bpp) , "NULL", test_suite , "2D ptr None (NULL) assignment" ) - -###################################################################################################################### - - test_suite = "structure" - - ball.obj.cana[0].ii = 250 - ball.obj.cana[0].jj = 350 - ball.obj.cana[1].ii = 260 - ball.obj.cana[1].jj = 360 - TRICK_EXPECT_EQ( ball.obj.cana[0].ii , 250 , test_suite , "1D array access" ) - TRICK_EXPECT_EQ( ball.obj.cana[0].jj , 350 , test_suite , "1D array access" ) - TRICK_EXPECT_EQ( ball.obj.cana[1].ii , 260 , test_suite , "1D array access" ) - TRICK_EXPECT_EQ( ball.obj.cana[1].jj , 360 , test_suite , "1D array access" ) - trick.trick_test_add_parent( test_suite , "1D array access" , "2797105872") - - ball.obj.can.ii = 150 - ball.obj.can.jj = 160 - ball.obj.can2 = ball.obj.can - TRICK_EXPECT_EQ( ball.obj.can2.ii , 150 , test_suite , "copy" ) - TRICK_EXPECT_EQ( ball.obj.can2.jj , 160 , test_suite , "copy" ) - - #ball.obj.cana[3] = ball.obj.can - - ball.obj.canp = ball.obj.can - TRICK_EXPECT_EQ( ball.obj.canp.ii , 150 , test_suite , "pointer assignment" ) - TRICK_EXPECT_EQ( ball.obj.canp.jj , 160 , test_suite , "pointer assignment" ) - - ball.obj.canp = ball.obj.cana[1] - TRICK_EXPECT_EQ( ball.obj.canp.ii , 260 , test_suite , "pointer to array element assignment" ) - TRICK_EXPECT_EQ( ball.obj.canp.jj , 360 , test_suite , "pointer to array element assignment" ) - - ball.obj.canp = trick.alloc_type( 2 , "CanCopy" ) - ball.obj.canp[0].ii = 400 - ball.obj.canp[0].jj = 500 - ball.obj.canp[1].ii = 600 - ball.obj.canp[1].jj = 700 - TRICK_EXPECT_EQ( ball.obj.canp[0].ii , 400 , test_suite , "pointer to array element assignment" ) - TRICK_EXPECT_EQ( ball.obj.canp[0].jj , 500 , test_suite , "pointer to array element assignment" ) - TRICK_EXPECT_EQ( ball.obj.canp[1].ii , 600 , test_suite , "pointer to array element assignment" ) - TRICK_EXPECT_EQ( ball.obj.canp[1].jj , 700 , test_suite , "pointer to array element assignment" ) - #print ball.obj.canp[0] - #print ball.obj.canp[1] - - ball.obj.canp = None - TRICK_EXPECT_EQ( str(ball.obj.canp) , "None", test_suite , "1D ptr None (NULL) assignment" ) - - # silently ignored! need to figure out how to flag this - #ball.obj.cannot = ball.obj.cannot2 - -###################################################################################################################### - - test_suite = "string" - - ball.obj.str = "hello" - TRICK_EXPECT_EQ( ball.obj.str , "hello" , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "165635378") - - #TODO: make a std::string typemap to allow assignment of string from char * - #ball.obj.str = ball.obj.cap[1] - #TRICK_EXPECT_EQ( ball.obj.str , "cap1" , "IPtest" , "string assignment from char *" ) - #print "ball.obj.str = " , ball.obj.str - -###################################################################################################################### - - test_suite = "bitfield" - - ball.obj.bit_0 = 7 - TRICK_EXPECT_EQ( ball.obj.bit_0 , 7 , test_suite , "assignment" ) - trick.trick_test_add_parent( test_suite , "assignment" , "1649805110") - - ball.obj.bit_1 = 17 - TRICK_EXPECT_EQ( ball.obj.bit_1 , -15 , test_suite , "assignment with overflow" ) - - ball.obj.boolbit_0 = True - TRICK_EXPECT_EQ( ball.obj.boolbit_0 , True , test_suite , "bool assignment" ) - - ball.obj.boolbit_1 = 2 - TRICK_EXPECT_EQ( ball.obj.boolbit_1 , True , test_suite , "bool assignment with overflow" ) - -###################################################################################################################### - - test_suite = "union" - - ball.obj.ut.i = 20 - TRICK_EXPECT_EQ( str(ball.obj.ut.i) , "20", test_suite , "test 1" ) - trick.trick_test_add_parent( test_suite , "test 1" , "3095148896") - - ball.obj.ut2.i = 30 - TRICK_EXPECT_EQ( str(ball.obj.ut2.i) , "30", test_suite , "test 2" ) - trick.trick_test_add_parent( test_suite , "test 2" , "3095148896") - -###################################################################################################################### - - # swig_int from swig_double - test_suite = "swig_int" - - ball.obj.dlbm = 50 - ball.obj.ilbm = ball.obj.dlbm - TRICK_EXPECT_EQ( ball.obj.ilbm , 50, test_suite , "assignment from swig_double" ) - trick.trick_test_add_parent( test_suite , "assignment from swig_double" , "2901141151") - - # addition - - ball.obj.ilbm = 50 - ball.obj.ikg = ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 22, test_suite , "units conversion" ) - - ball.obj.ikg = ball.obj.ilbm + 20 - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "addition with integer" ) - - ball.obj.ikg = ball.obj.ilbm + 20.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 32, test_suite , "addition with float" ) - - ball.obj.ikg = ball.obj.ilbm + ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 45, test_suite , "addition with swig_int" ) - - ball.obj.ikg = 50 - ball.obj.ikg = ball.obj.ilbm + ball.obj.ikg - TRICK_EXPECT_EQ( ball.obj.ikg , 72, test_suite , "addition with swig_int and unit conversion" ) - - ball.obj.dlbm = 10 - ball.obj.ikg = ball.obj.ilbm + ball.obj.dlbm - TRICK_EXPECT_EQ( ball.obj.ikg , 27, test_suite , "addition with swig_double" ) - - ball.obj.dkg = 10 - ball.obj.ikg = ball.obj.ilbm + ball.obj.dkg - TRICK_EXPECT_EQ( ball.obj.ikg , 32, test_suite , "addition with swig_double and unit conversion" ) - - # subtraction - - ball.obj.ikg = ball.obj.ilbm - 20 - TRICK_EXPECT_EQ( ball.obj.ikg , 13, test_suite , "subtraction with integer" ) - - ball.obj.ikg = ball.obj.ilbm - 20.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 13, test_suite , "subtraction with float" ) - - ball.obj.ikg = ball.obj.ilbm - ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 0, test_suite , "subtraction with swig_int" ) - - ball.obj.ikg = 10 - ball.obj.ikg = ball.obj.ilbm - ball.obj.ikg - TRICK_EXPECT_EQ( ball.obj.ikg , 12, test_suite , "subtraction with swig_int and unit conversion" ) - - ball.obj.dlbm = 10 - ball.obj.ikg = ball.obj.ilbm - ball.obj.dlbm - TRICK_EXPECT_EQ( ball.obj.ikg , 18, test_suite , "subtraction with swig_double" ) - - ball.obj.dkg = 10 - ball.obj.ikg = ball.obj.ilbm - ball.obj.dkg - TRICK_EXPECT_EQ( ball.obj.ikg , 12, test_suite , "subtraction with swig_double and unit conversion" ) - - # multiplication - - ball.obj.ilbm = 50 - ball.obj.ikg = ball.obj.ilbm * 3 - TRICK_EXPECT_EQ( ball.obj.ikg , 68, test_suite , "multiplication with int" ) - - ball.obj.ikg = ball.obj.ilbm * 2.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 65, test_suite , "multiplication with float" ) - - ball.obj.ilbm = 50 - ball.obj.i = 2 - ball.obj.ikg = ball.obj.ilbm * ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 45, test_suite , "multiplication with unitless swig_int" ) - - ball.obj.ilbm = 50 - ball.obj.dno_units = 2.2 - ball.obj.ikg = ball.obj.ilbm * ball.obj.dno_units - TRICK_EXPECT_EQ( ball.obj.ikg , 49, test_suite , "multiplication with unitless swig_double" ) - - # division - - ball.obj.ilbm = 50 - ball.obj.ikg = ball.obj.ilbm / 3 - TRICK_EXPECT_EQ( ball.obj.ikg , 7, test_suite , "division with int" ) - - ball.obj.ikg = ball.obj.ilbm / 2.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 7, test_suite , "division with float" ) - - # floor division - - ball.obj.ikg = 29 - ball.obj.ikg = ball.obj.ikg // 4 - TRICK_EXPECT_EQ( ball.obj.ikg , 7, test_suite , "floor division with int" ) - - ball.obj.ikg = 29 - ball.obj.ikg = ball.obj.ikg // 4.5 - TRICK_EXPECT_EQ( ball.obj.ikg , 6, test_suite , "floor division with int" ) - - # mod - - ball.obj.ikg = 29 - ball.obj.ikg = ball.obj.ikg % 4 - TRICK_EXPECT_EQ( ball.obj.ikg , 1, test_suite , "mod with int" ) - - ball.obj.ikg = 29 - ball.obj.ikg = ball.obj.ikg % 4.5 - TRICK_EXPECT_EQ( ball.obj.ikg , 2, test_suite , "mod with float" ) - - ball.obj.ilbm = 50 - ball.obj.i = 13 - ball.obj.ikg = ball.obj.ilbm % ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "mod with unitless swig_int" ) - - ball.obj.ilbm = 50 - ball.obj.dno_units = 13.5 - ball.obj.ikg = ball.obj.ilbm % ball.obj.dno_units - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "mod with unitless swig_double" ) - - # pow - - ball.obj.i = 5 - ball.obj.i = pow(ball.obj.i , 4) - TRICK_EXPECT_EQ( ball.obj.i , 625, test_suite , "pow with int" ) - - ball.obj.i = 5 - ball.obj.i = pow(ball.obj.i , 2.5) - TRICK_EXPECT_EQ( ball.obj.i , 55, test_suite , "pow with float" ) - - ball.obj.i = 5 - ball.obj.i = pow(ball.obj.i , ball.obj.i) - TRICK_EXPECT_EQ( ball.obj.i , 3125, test_suite , "pow with unitless swig_int" ) - - ball.obj.i = 5 - ball.obj.dno_units = 5.0 - ball.obj.i = pow(ball.obj.i , ball.obj.dno_units) - TRICK_EXPECT_EQ( ball.obj.i , 3125, test_suite , "pow with unitless swig_double" ) - - # left shift - - ball.obj.ikg = 16 - ball.obj.ikg = ball.obj.ikg << 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 64, test_suite , "left shift with int" ) - - ball.obj.ikg = 16 - ball.obj.i = 1 - ball.obj.ikg = ball.obj.ikg << ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 32, test_suite , "left shift with unitless swig_int" ) - - # right shift - - ball.obj.ikg = 16 - ball.obj.ikg = ball.obj.ikg >> 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "right shift with int" ) - - ball.obj.ikg = 16 - ball.obj.i = 1 - ball.obj.ikg = ball.obj.ikg >> ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 8, test_suite , "left shift with unitless swig_int" ) - - # and - - ball.obj.ikg = 12 - ball.obj.ikg = ball.obj.ikg & 5 - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "and with int" ) - - ball.obj.ikg = 12 - ball.obj.i = 5 - ball.obj.ikg = ball.obj.ikg & ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "and with unitless swig_int" ) - - # xor - - ball.obj.ikg = 29 - ball.obj.ikg = ball.obj.ikg ^ 7 - TRICK_EXPECT_EQ( ball.obj.ikg , 26, test_suite , "xor with int" ) - - ball.obj.ikg = 29 - ball.obj.i = 7 - ball.obj.ikg = ball.obj.ikg ^ ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 26, test_suite , "xor with unitless swig_int" ) - - # or - - ball.obj.ikg = 29 - ball.obj.ikg = ball.obj.ikg | 7 - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "or with int" ) - - ball.obj.ikg = 29 - ball.obj.i = 7 - ball.obj.ikg = ball.obj.ikg | ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "or with unitless swig_int" ) - - # reverse addition - - ball.obj.ikg = 20 + ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "reverse addition with integer" ) - - ball.obj.ikg = 20.9 + ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 32, test_suite , "reverse addition with float" ) - - # reverse subtraction - - ball.obj.ikg = 120 - ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "reverse subtraction with integer" ) - - ball.obj.ikg = 120.9 - ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 32, test_suite , "reverse subtraction with float" ) - - # reverse multiplication - - ball.obj.ilbm = 50 - ball.obj.ikg = 3 * ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 68, test_suite , "reverse multiplication with int" ) - - ball.obj.ikg = 2.9 * ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 65, test_suite , "reverse multiplication with float" ) - - # reverse division - - ball.obj.i = 5 - ball.obj.i = 62 / ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 12, test_suite , "reverse division with int" ) - - ball.obj.i = 5 - ball.obj.i = 62.5 / ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 12, test_suite , "reverse division with float" ) - - # reverse mod - - ball.obj.i = 5 - ball.obj.i = 62 % ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 2, test_suite , "reverse mod with int" ) - - ball.obj.i = 5 - ball.obj.i = 62.5 % ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 2, test_suite , "reverse mod with float" ) - - # pow - - ball.obj.i = 4 - ball.obj.i = pow(4 , ball.obj.i) - TRICK_EXPECT_EQ( ball.obj.i , 256, test_suite , "reverse pow with int" ) - - ball.obj.i = 5 - ball.obj.i = pow(2.1 , ball.obj.i) - TRICK_EXPECT_EQ( ball.obj.i , 40, test_suite , "reverse pow with float" ) - - # reverse lshift - ball.obj.i = 3 - ball.obj.i = 8 << ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 64, test_suite , "reverse lshift with int" ) - - # reverse rshift - ball.obj.i = 2 - ball.obj.i = 8 >> ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 2, test_suite , "reverse rshift with int" ) - - # reverse and - - ball.obj.ikg = 12 - ball.obj.ikg = 5 & ball.obj.ikg - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "reverse and with int" ) - - # reverse xor - - ball.obj.ikg = 29 - ball.obj.ikg = 7 ^ ball.obj.ikg - TRICK_EXPECT_EQ( ball.obj.ikg , 26, test_suite , "reverse xor with int" ) - - # reverse or - - ball.obj.ikg = 29 - ball.obj.ikg = 7 | ball.obj.ikg - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "reverse or with int" ) - - # in-place addition - - ball.obj.ikg = 10 - ball.obj.ikg += 20 - TRICK_EXPECT_EQ( ball.obj.ikg , 30, test_suite , "in-place addition with integer" ) - - ball.obj.ikg += 20.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 51, test_suite , "in-place addition with float" ) - - ball.obj.ilbm = 10 - ball.obj.ikg += ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 55, test_suite , "in-place addition with swig_int" ) - - ball.obj.dkg = 10 - ball.obj.ikg += ball.obj.dkg - TRICK_EXPECT_EQ( ball.obj.ikg , 65, test_suite , "in-place addition with swig_double and unit conversion" ) - - # in-place subtraction - - ball.obj.ikg = 10 - ball.obj.ikg -= 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 8, test_suite , "in-place subtraction with integer" ) - - ball.obj.ikg -= 2.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 5, test_suite , "in-place subtraction with float" ) - - ball.obj.ilbm = 10 - ball.obj.ikg -= ball.obj.ilbm - TRICK_EXPECT_EQ( ball.obj.ikg , 1, test_suite , "in-place subtraction with swig_int" ) - - ball.obj.dkg = 1 - ball.obj.ikg -= ball.obj.dkg - TRICK_EXPECT_EQ( ball.obj.ikg , 0, test_suite , "in-place subtraction with swig_double and unit conversion" ) - - # in-place multiplication - - ball.obj.ikg = 10 - ball.obj.ikg *= 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 20, test_suite , "in-place multiplication with integer" ) - - ball.obj.ikg *= 3.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 78, test_suite , "in-place multiplication with float" ) - - ball.obj.ikg = 10 - ball.obj.i = 2 - ball.obj.ikg *= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 20, test_suite , "in-place multiplication with unitless swig_int" ) - - ball.obj.ikg = 10 - ball.obj.dno_units = 3.9 - ball.obj.ikg *= ball.obj.dno_units - TRICK_EXPECT_EQ( ball.obj.ikg , 39, test_suite , "in-place multiplication with unitless swig_double" ) - # in-place division - - ball.obj.ikg = 10 - ball.obj.ikg /= 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 5, test_suite , "in-place division with integer" ) - - ball.obj.ikg = 10 - ball.obj.ikg /= 3.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 3, test_suite , "in-place division with float" ) - - ball.obj.ikg = 10 - ball.obj.i = 2 - ball.obj.ikg /= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 5, test_suite , "in-place division with unitless swig_int" ) - - # in-place mod - - ball.obj.ikg = 10 - ball.obj.ikg %= 3 - TRICK_EXPECT_EQ( ball.obj.ikg , 1, test_suite , "in-place mod with integer" ) - - ball.obj.ikg = 10 - ball.obj.ikg %= 3.9 - TRICK_EXPECT_EQ( ball.obj.ikg , 2, test_suite , "in-place mod with float" ) - - ball.obj.ikg = 10 - ball.obj.i = 3 - ball.obj.ikg %= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 1, test_suite , "in-place mod with unitless swig_int" ) - - # in-place pow - - ball.obj.i = 5 - ball.obj.i **= 4 - TRICK_EXPECT_EQ( ball.obj.i , 625, test_suite , "in-place pow with int" ) - - ball.obj.i = 5 - ball.obj.i **= 2.5 - TRICK_EXPECT_EQ( ball.obj.i , 56, test_suite , "in-place pow with float" ) - - ball.obj.i = 5 - ball.obj.i **= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.i , 3125, test_suite , "in-place pow with unitless swig_int" ) - - ball.obj.i = 5 - ball.obj.dno_units = 5.0 - ball.obj.i **= ball.obj.dno_units - TRICK_EXPECT_EQ( ball.obj.i , 3125, test_suite , "in-place pow with unitless swig_double" ) - - # in-place left shift - - ball.obj.ikg = 16 - ball.obj.ikg <<= 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 64, test_suite , "left shift with int" ) - - ball.obj.i = 16 - ball.obj.ia[0] = 1 - ball.obj.i <<= ball.obj.ia[0] - TRICK_EXPECT_EQ( ball.obj.i , 32, test_suite , "left shift with unitless swig_int" ) - - # in-place right shift - - ball.obj.ikg = 16 - ball.obj.ikg >>= 2 - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "right shift with int" ) - - ball.obj.ikg = 16 - ball.obj.i = 1 - ball.obj.ikg >>= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 8, test_suite , "left shift with unitless swig_int" ) - - # in-place and - - ball.obj.ikg = 12 - ball.obj.ikg &= 5 - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "and with int" ) - - ball.obj.ikg = 12 - ball.obj.i = 5 - ball.obj.ikg &= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 4, test_suite , "and with unitless swig_int" ) - - # in-place xor - - ball.obj.ikg = 29 - ball.obj.ikg ^= 7 - TRICK_EXPECT_EQ( ball.obj.ikg , 26, test_suite , "xor with int" ) - - ball.obj.ikg = 29 - ball.obj.i = 7 - ball.obj.ikg ^= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 26, test_suite , "xor with unitless swig_int" ) - - # in-place or - - ball.obj.ikg = 29 - ball.obj.ikg |= 7 - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "or with int" ) - - ball.obj.ikg = 29 - ball.obj.i = 7 - ball.obj.ikg |= ball.obj.i - TRICK_EXPECT_EQ( ball.obj.ikg , 31, test_suite , "or with unitless swig_int" ) - - # less than - - ball.obj.ikg = 20 - ball.obj.ilbm = 20 - - test = ball.obj.ikg < 21 - TRICK_EXPECT_EQ( test , True, test_suite , "lt with integer" ) - - test = ball.obj.ikg < 20.5 - TRICK_EXPECT_EQ( test , True, test_suite , "lt with float" ) - - test = ball.obj.ikg < ball.obj.ilbm - TRICK_EXPECT_EQ( test , False, test_suite , "lt with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.ikg < ball.obj.dkg - TRICK_EXPECT_EQ( test , True, test_suite , "lt with swig_double and unit conversion" ) - - # less than or equal - - ball.obj.ikg = 20 - ball.obj.ilbm = 20 - - test = ball.obj.ikg <= 21 - TRICK_EXPECT_EQ( test , True, test_suite , "le with integer" ) - - test = ball.obj.ikg <= 20.5 - TRICK_EXPECT_EQ( test , True, test_suite , "le with float" ) - - test = ball.obj.ikg <= ball.obj.ilbm - TRICK_EXPECT_EQ( test , False, test_suite , "le with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.ikg <= ball.obj.dkg - TRICK_EXPECT_EQ( test , True, test_suite , "le with swig_double and unit conversion" ) - - # equal - - test = ball.obj.ikg == 21 - TRICK_EXPECT_EQ( test , False, test_suite , "eq with integer" ) - - test = ball.obj.ikg == 20.5 - TRICK_EXPECT_EQ( test , False, test_suite , "eq with float" ) - - test = ball.obj.ikg == ball.obj.ilbm - TRICK_EXPECT_EQ( test , False, test_suite , "eq with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.ikg == ball.obj.dkg - TRICK_EXPECT_EQ( test , False, test_suite , "eq with swig_double and unit conversion" ) - - # not equal - - test = ball.obj.ikg != 21 - TRICK_EXPECT_EQ( test , True, test_suite , "ne with integer" ) - - test = ball.obj.ikg != 20.5 - TRICK_EXPECT_EQ( test , True, test_suite , "ne with float" ) - - test = ball.obj.ikg != ball.obj.ilbm - TRICK_EXPECT_EQ( test , True, test_suite , "ne with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.ikg != ball.obj.dkg - TRICK_EXPECT_EQ( test , True, test_suite , "ne with swig_double and unit conversion" ) - - # greater than - - ball.obj.ikg = 20 - ball.obj.ilbm = 20 - - test = ball.obj.ikg > 21 - TRICK_EXPECT_EQ( test , False, test_suite , "gt with integer" ) - - test = ball.obj.ikg > 20.5 - TRICK_EXPECT_EQ( test , False, test_suite , "gt with float" ) - - test = ball.obj.ikg > ball.obj.ilbm - TRICK_EXPECT_EQ( test , True, test_suite , "gt with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.ikg > ball.obj.dkg - TRICK_EXPECT_EQ( test , False, test_suite , "gt with swig_double and unit conversion" ) - - # greater than or equal - - ball.obj.ikg = 20 - ball.obj.ilbm = 20 - - test = ball.obj.ikg >= 21 - TRICK_EXPECT_EQ( test , False, test_suite , "ge with integer" ) - - test = ball.obj.ikg >= 20.5 - TRICK_EXPECT_EQ( test , False, test_suite , "ge with float" ) - - test = ball.obj.ikg >= ball.obj.ilbm - TRICK_EXPECT_EQ( test , True, test_suite , "ge with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.ikg >= ball.obj.dkg - TRICK_EXPECT_EQ( test , False, test_suite , "ge with swig_double and unit conversion" ) - - # unary operators - - ball.obj.ikg = 20 - test = -ball.obj.ikg - TRICK_EXPECT_EQ( test , -20, test_suite , "unary neg" ) - - test = +ball.obj.ikg - TRICK_EXPECT_EQ( test , 20, test_suite , "unary pos" ) - - ball.obj.ikg = -20 - test = abs(ball.obj.ikg) - TRICK_EXPECT_EQ( test , 20, test_suite , "unary abs" ) - - ball.obj.ikg = 20 - test = ~ball.obj.ikg - TRICK_EXPECT_EQ( test , -21, test_suite , "unary invert" ) - - # conversion - ball.obj.ikg = 20 - test = int(ball.obj.ikg) - TRICK_EXPECT_EQ( test , 20, test_suite , "int" ) - - ball.obj.ikg = 20 - test = long(ball.obj.ikg) - TRICK_EXPECT_EQ( test , 20, test_suite , "long" ) - - ball.obj.ikg = 20 - test = float(ball.obj.ikg) - TRICK_EXPECT_EQ( test , 20, test_suite , "float" ) - - ball.obj.ikg = 20 - test = oct(ball.obj.ikg) - TRICK_EXPECT_EQ( test , "024", test_suite , "oct" ) - - ball.obj.ikg = 20 - test = hex(ball.obj.ikg) - TRICK_EXPECT_EQ( test , "0x14", test_suite , "hex" ) - -###################################################################################################################### - - # swig_integer to swig_double assignment - test_suite = "swig_double" - - ball.obj.ilbm = 50 - ball.obj.dlbm = ball.obj.ilbm - - # swig_double unitless to swig_double assignment - - ball.obj.dno_units = trick.attach_units("--" , 60.6) - TRICK_EXPECT_EQ( ball.obj.dno_units , 60.6, test_suite , "assignment from unitless swig_double" ) - trick.trick_test_add_parent( test_suite , "assignment from unitless swig_double" , "1164062396") - - # addition - - ball.obj.dlbm = 50 - ball.obj.dkg = ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 22.6796, 0.0001, test_suite , "units conversion" ) - - ball.obj.dkg = ball.obj.dlbm + 20 - TRICK_EXPECT_NEAR( ball.obj.dkg , 31.7515, 0.0001, test_suite , "addition with integer" ) - - ball.obj.dkg = ball.obj.dlbm + 20.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 32.1597, 0.0001, test_suite , "addition with float" ) - - ball.obj.ilbm = 50 - ball.obj.dkg = ball.obj.dlbm + ball.obj.ilbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 45.3592, 0.0001, test_suite , "addition with swig_int" ) - - ball.obj.dkg = 50 - ball.obj.ikg = 50 - ball.obj.dkg = ball.obj.dlbm + ball.obj.ikg - TRICK_EXPECT_NEAR( ball.obj.dkg , 72.6796, 0.0001, test_suite , "addition with swig_int and unit conversion" ) - - ball.obj.dlbm = 10 - ball.obj.dkg = ball.obj.dlbm + ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 9.07185, 0.0001, test_suite , "addition with swig_double" ) - - ball.obj.dkg = 10 - ball.obj.dkg = ball.obj.dlbm + ball.obj.dkg - TRICK_EXPECT_NEAR( ball.obj.dkg , 14.5359, 0.0001, test_suite , "addition with swig_double and unit conversion" ) - - # subtraction - - ball.obj.dlbm = 50 - ball.obj.dkg = ball.obj.dlbm - 20 - TRICK_EXPECT_NEAR( ball.obj.dkg , 13.6078, 0.0001, test_suite , "subtraction with integer" ) - - ball.obj.dkg = ball.obj.dlbm - 20.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 13.1995, 0.0001, test_suite , "subtraction with float" ) - - ball.obj.ilbm = 50 - ball.obj.dkg = ball.obj.dlbm - ball.obj.ilbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 0, 0.0001, test_suite , "subtraction with swig_int" ) - - ball.obj.dkg = 50 - ball.obj.ikg = 50 - ball.obj.dkg = ball.obj.dlbm - ball.obj.ikg - TRICK_EXPECT_NEAR( ball.obj.dkg , -27.3204, 0.0001, test_suite , "subtraction with swig_int and unit conversion" ) - - ball.obj.dlbm = 10 - ball.obj.dkg = ball.obj.dlbm - ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 0, 0.0001, test_suite , "subtraction with swig_double" ) - - ball.obj.dkg = 10 - ball.obj.dkg = ball.obj.dlbm - ball.obj.dkg - TRICK_EXPECT_NEAR( ball.obj.dkg , -5.46408, 0.0001, test_suite , "subtraction with swig_double and unit conversion" ) - - # multiplication - - ball.obj.dlbm = 50 - ball.obj.dkg = ball.obj.dlbm * 3 - TRICK_EXPECT_NEAR( ball.obj.dkg , 68.0389, 0.0001, test_suite , "multiplication with int" ) - - ball.obj.dkg = ball.obj.ilbm * 2.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 65.7709, 0.0001, test_suite , "multiplication with float" ) - - ball.obj.dlbm = 50 - ball.obj.i = 2 - ball.obj.dkg = ball.obj.dlbm * ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 45.3592, 0.0001, test_suite , "multiplication with unitless swig_int" ) - - ball.obj.dlbm = 50 - ball.obj.dno_units = 2.2 - ball.obj.dkg = ball.obj.dlbm * ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 49.8952, 0.0001, test_suite , "multiplication with unitless swig_double" ) - - # division - - ball.obj.dlbm = 50 - ball.obj.dkg = ball.obj.dlbm / 3 - TRICK_EXPECT_NEAR( ball.obj.dkg , 7.55987, 0.0001, test_suite , "division with int" ) - - ball.obj.dkg = ball.obj.dlbm / 2.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 7.82056, 0.0001, test_suite , "division with float" ) - - ball.obj.i = 5 - ball.obj.dkg = ball.obj.dlbm / ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 4.53592, 0.0001, test_suite , "division with unitless swig_int" ) - - ball.obj.dno_units = 5.1 - ball.obj.dkg = ball.obj.dlbm / ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 4.44698, 0.0001, test_suite , "division with unitless swig_double" ) - - # floor division - - ball.obj.dkg = 29 - ball.obj.dkg = ball.obj.dkg // 4 - TRICK_EXPECT_NEAR( ball.obj.dkg , 7, 0.0001, test_suite , "floor division with int" ) - - ball.obj.dkg = 29 - ball.obj.dkg = ball.obj.dkg // 4.5 - TRICK_EXPECT_NEAR( ball.obj.dkg , 6, 0.0001, test_suite , "floor division with float" ) - - ball.obj.dkg = 29 - ball.obj.i = 4 - ball.obj.dkg = ball.obj.dkg // ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 7, 0.0001, test_suite , "floor division with unitless swig_int" ) - - ball.obj.dkg = 29 - ball.obj.dno_units = 4.5 - ball.obj.dkg = ball.obj.dkg // ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 6, 0.0001, test_suite , "floor division with unitless swig_double" ) - - - # mod - - ball.obj.dkg = 29 - ball.obj.dkg = ball.obj.dkg % 4 - TRICK_EXPECT_NEAR( ball.obj.dkg , 1, 0.0001, test_suite , "mod with int" ) - - ball.obj.dkg = 29 - ball.obj.dkg = ball.obj.dkg % 4.5 - TRICK_EXPECT_NEAR( ball.obj.dkg , 2, 0.0001, test_suite , "mod with float" ) - - ball.obj.dlbm = 50 - ball.obj.i = 13 - ball.obj.dlbm = ball.obj.dlbm % ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dlbm , 11, 0.0001, test_suite , "mod with unitless swig_int" ) - - ball.obj.dlbm = 50 - ball.obj.dno_units = 13.5 - ball.obj.dlbm = ball.obj.dlbm % ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dlbm , 9.5, 0.0001, test_suite , "mod with unitless swig_double" ) - - # pow - - ball.obj.dno_units = 5 - ball.obj.dno_units = pow(ball.obj.dno_units , 4) - TRICK_EXPECT_NEAR( ball.obj.dno_units , 625, 0.0001, test_suite , "pow with int" ) - - ball.obj.dno_units = 5 - ball.obj.dno_units = pow(ball.obj.dno_units , 2.5) - TRICK_EXPECT_NEAR( ball.obj.dno_units , 55.9017, 0.0001, test_suite , "pow with float" ) - - ball.obj.i = 5 - ball.obj.dno_units = 5.0 - ball.obj.dno_units = pow(ball.obj.dno_units , ball.obj.i) - TRICK_EXPECT_NEAR( ball.obj.dno_units , 3125, 0.0001, test_suite , "pow with unitless swig_int" ) - - ball.obj.dno_units = 5.0 - ball.obj.dno_units = pow(ball.obj.dno_units , ball.obj.dno_units) - TRICK_EXPECT_NEAR( ball.obj.dno_units , 3125, 0.0001, test_suite , "pow with unitless swig_double" ) - - # reverse addition - - ball.obj.dlbm = 10 - ball.obj.dkg = 20 + ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 13.6078, 0.0001, test_suite , "reverse addition with integer" ) - - ball.obj.dkg = 20.9 + ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 14.016, 0.0001, test_suite , "reverse addition with float" ) - - # reverse subtraction - - ball.obj.dkg = 120 - ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 49.8952, 0.0001, test_suite , "reverse subtraction with integer" ) - - ball.obj.dkg = 120.9 - ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 50.3034, 0.0001, test_suite , "reverse subtraction with float" ) - - # reverse multiplication - - ball.obj.dlbm = 50 - ball.obj.dkg = 3 * ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 68.0389, 0.0001, test_suite , "reverse multiplication with int" ) - - ball.obj.dkg = 2.9 * ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 65.7709, 0.0001, test_suite , "reverse multiplication with float" ) - - - # reverse division - - ball.obj.dno_units = 5 - ball.obj.dno_units = 62 / ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 12.4, 0.0001, test_suite , "reverse division with int" ) - - ball.obj.dno_units = 5 - ball.obj.dno_units = 62.5 / ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 12.5, 0.0001, test_suite , "reverse division with float" ) - - # reverse floor division - ball.obj.dno_units = 5 - ball.obj.dno_units = 62 // ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 12, 0.0001, test_suite , "reverse floor division with int" ) - - ball.obj.dno_units = 5 - ball.obj.dno_units = 62.5 // ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 12, 0.0001, test_suite , "reverse floor division with float" ) - - - # reverse mod - - ball.obj.dno_units = 5 - ball.obj.dno_units = 62 % ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 2, 0.0001, test_suite , "reverse mod with int" ) - - ball.obj.dno_units = 5 - ball.obj.dno_units = 62.5 % ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 2.5, 0.0001, test_suite , "reverse mod with float" ) - - # reverse pow - - ball.obj.dno_units = 4 - ball.obj.dno_units = pow(4 , ball.obj.dno_units) - TRICK_EXPECT_NEAR( ball.obj.dno_units , 256, 0.0001, test_suite , "reverse pow with int" ) - - ball.obj.dno_units = 5 - ball.obj.dno_units = pow(2.1 , ball.obj.dno_units) - TRICK_EXPECT_NEAR( ball.obj.dno_units , 40.841 , 0.0001, test_suite , "reverse pow with float" ) - - # in-place addition - - ball.obj.dkg = 10 - ball.obj.dkg += 20 - TRICK_EXPECT_NEAR( ball.obj.dkg , 30, 0.0001, test_suite , "in-place addition with integer" ) - - ball.obj.dkg += 20.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 50.9, 0.0001, test_suite , "in-place addition with float" ) - - ball.obj.ilbm = 10 - ball.obj.dkg += ball.obj.ilbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 55.4359, 0.0001, test_suite , "in-place addition with swig_int" ) - - ball.obj.dkg = 10 - ball.obj.dkg += ball.obj.dkg - TRICK_EXPECT_NEAR( ball.obj.dkg , 20, 0.0001, test_suite , "in-place addition with swig_double and unit conversion" ) - - # in-place subtraction - - ball.obj.dkg = 10 - ball.obj.dkg -= 2 - TRICK_EXPECT_NEAR( ball.obj.dkg , 8, 0.0001, test_suite , "in-place subtraction with integer" ) - - ball.obj.dkg -= 2.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 5.1, 0.0001, test_suite , "in-place subtraction with float" ) - - ball.obj.dlbm = 10 - ball.obj.dkg -= ball.obj.dlbm - TRICK_EXPECT_NEAR( ball.obj.dkg , 0.564076, 0.0001, test_suite , "in-place subtraction with swig_int" ) - - ball.obj.dkg = 1 - ball.obj.dkg -= ball.obj.dkg - TRICK_EXPECT_NEAR( ball.obj.dkg , 0, 0.0001, test_suite , "in-place subtraction with swig_double and unit conversion" ) - - # in-place multiplication - - ball.obj.dkg = 10 - ball.obj.dkg *= 2 - TRICK_EXPECT_NEAR( ball.obj.dkg , 20, 0.0001, test_suite , "in-place multiplication with integer" ) - - ball.obj.dkg *= 3.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 78, 0.0001, test_suite , "in-place multiplication with float" ) - - ball.obj.dkg = 10 - ball.obj.i = 2 - ball.obj.dkg *= ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 20, 0.0001, test_suite , "in-place multiplication with unitless swig_int" ) - - ball.obj.dkg = 10 - ball.obj.dno_units = 2 - ball.obj.dkg *= ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 20, 0.0001, test_suite , "in-place multiplication with unitless swig_int" ) - - # in-place division - - ball.obj.dkg = 10 - ball.obj.dkg /= 2 - TRICK_EXPECT_NEAR( ball.obj.dkg , 5, 0.0001, test_suite , "in-place division with integer" ) - - ball.obj.dkg = 10 - ball.obj.dkg /= 3.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 2.5641, 0.0001, test_suite , "in-place division with float" ) - - ball.obj.dkg = 10 - ball.obj.i = 2 - ball.obj.dkg /= ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) - - ball.obj.dkg = 10 - ball.obj.dno_units = 2 - ball.obj.dkg /= ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) - - # in-place floor division - - ball.obj.dkg = 10.1 - ball.obj.dkg //= 2 - TRICK_EXPECT_NEAR( ball.obj.dkg , 5, 0.0001, test_suite , "in-place division with integer" ) - - ball.obj.dkg = 10.1 - ball.obj.dkg //= 3.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 2, 0.0001, test_suite , "in-place division with float" ) - - ball.obj.dkg = 10.1 - ball.obj.i = 2 - ball.obj.dkg //= ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) - - ball.obj.dkg = 10.1 - ball.obj.dno_units = 2 - ball.obj.dkg //= ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 5, 0.0001, test_suite , "in-place division with unitless swig_int" ) - - # in-place mod - - ball.obj.dkg = 10.1 - ball.obj.dkg %= 3 - TRICK_EXPECT_NEAR( ball.obj.dkg , 1.1, 0.0001, test_suite , "in-place mod with integer" ) - - ball.obj.dkg = 10.1 - ball.obj.dkg %= 3.9 - TRICK_EXPECT_NEAR( ball.obj.dkg , 2.3, 0.0001, test_suite , "in-place mod with float" ) - - ball.obj.dkg = 10.1 - ball.obj.i = 3 - ball.obj.dkg %= ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dkg , 1.1, 0.0001, test_suite , "in-place mod with unitless swig_int" ) - - ball.obj.dkg = 10.1 - ball.obj.dno_units = 4 - ball.obj.dkg %= ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dkg , 2.1, 0.0001, test_suite , "in-place mod with unitless swig_double" ) - - # in-place pow - - ball.obj.dno_units = 5 - ball.obj.dno_units **= 4 - TRICK_EXPECT_NEAR( ball.obj.dno_units , 625, 0.0001, test_suite , "in-place pow with int" ) - - ball.obj.dno_units = 5 - ball.obj.dno_units **= 2.5 - TRICK_EXPECT_NEAR( ball.obj.dno_units , 55.9017, 0.0001, test_suite , "in-place pow with float" ) - - ball.obj.i = 5 - ball.obj.dno_units = 5.0 - ball.obj.dno_units **= ball.obj.i - TRICK_EXPECT_NEAR( ball.obj.dno_units , 3125, 0.0001, test_suite , "in-place pow with unitless swig_int" ) - - ball.obj.dno_units = 5.0 - ball.obj.dno_units **= ball.obj.dno_units - TRICK_EXPECT_NEAR( ball.obj.dno_units , 3125, 0.0001, test_suite , "in-place pow with unitless swig_double" ) - - # less than - - ball.obj.dkg = 20 - ball.obj.dlbm = 20 - - test = ball.obj.dkg < 21 - TRICK_EXPECT_EQ( test , True, test_suite , "lt with integer" ) - - test = ball.obj.dkg < 20.5 - TRICK_EXPECT_EQ( test , True, test_suite , "lt with float" ) - - test = ball.obj.dkg < ball.obj.dlbm - TRICK_EXPECT_EQ( test , False, test_suite , "lt with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.dkg < ball.obj.dkg - TRICK_EXPECT_EQ( test , False, test_suite , "lt with swig_double and unit conversion" ) - - # less than or equal - - ball.obj.dkg = 20 - ball.obj.dlbm = 20 - - test = ball.obj.dkg <= 21 - TRICK_EXPECT_EQ( test , True, test_suite , "le with integer" ) - - test = ball.obj.dkg <= 20.5 - TRICK_EXPECT_EQ( test , True, test_suite , "le with float" ) - - test = ball.obj.dkg <= ball.obj.dlbm - TRICK_EXPECT_EQ( test , False, test_suite , "le with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.dkg <= ball.obj.dkg - TRICK_EXPECT_EQ( test , True, test_suite , "le with swig_double and unit conversion" ) - - # equal - - test = ball.obj.dkg == 21 - TRICK_EXPECT_EQ( test , False, test_suite , "eq with integer" ) - - test = ball.obj.dkg == 20.5 - TRICK_EXPECT_EQ( test , False, test_suite , "eq with float" ) - - test = ball.obj.dkg == ball.obj.dlbm - TRICK_EXPECT_EQ( test , False, test_suite , "eq with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.dkg == ball.obj.dkg - TRICK_EXPECT_EQ( test , True, test_suite , "eq with swig_double and unit conversion" ) - - # not equal - - test = ball.obj.dkg != 21 - TRICK_EXPECT_EQ( test , True, test_suite , "ne with integer" ) - - test = ball.obj.dkg != 20.5 - TRICK_EXPECT_EQ( test , True, test_suite , "ne with float" ) - - test = ball.obj.dkg != ball.obj.dlbm - TRICK_EXPECT_EQ( test , True, test_suite , "ne with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.dkg != ball.obj.dkg - TRICK_EXPECT_EQ( test , False, test_suite , "ne with swig_double and unit conversion" ) - - # greater than - - ball.obj.dkg = 20 - ball.obj.dlbm = 20 - - test = ball.obj.dkg > 21 - TRICK_EXPECT_EQ( test , False, test_suite , "gt with integer" ) - - test = ball.obj.dkg > 20.5 - TRICK_EXPECT_EQ( test , False, test_suite , "gt with float" ) - - test = ball.obj.dkg > ball.obj.dlbm - TRICK_EXPECT_EQ( test , True, test_suite , "gt with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.dkg > ball.obj.dkg - TRICK_EXPECT_EQ( test , False, test_suite , "gt with swig_double and unit conversion" ) - - # greater than or equal - - ball.obj.dkg = 20 - ball.obj.dlbm = 20 - - test = ball.obj.dkg >= 21 - TRICK_EXPECT_EQ( test , False, test_suite , "ge with integer" ) - - test = ball.obj.dkg >= 20.5 - TRICK_EXPECT_EQ( test , False, test_suite , "ge with float" ) - - test = ball.obj.dkg >= ball.obj.dlbm - TRICK_EXPECT_EQ( test , True, test_suite , "ge with swig_int and unit conversion" ) - - ball.obj.dkg = 20.1 - test = ball.obj.dkg >= ball.obj.dkg - TRICK_EXPECT_EQ( test , True, test_suite , "ge with swig_double and unit conversion" ) - - # unary operators - - ball.obj.dkg = 20 - test = -ball.obj.dkg - TRICK_EXPECT_NEAR( test , -20, 0.0001, test_suite , "unary neg" ) - - test = +ball.obj.dkg - TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "unary pos" ) - - ball.obj.dkg = -20 - test = abs(ball.obj.dkg) - TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "unary abs" ) - - # conversion - ball.obj.dkg = 20 - test = int(ball.obj.dkg) - TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "int" ) - - ball.obj.dkg = 20 - test = long(ball.obj.dkg) - TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "long" ) - - ball.obj.dkg = 20 - test = float(ball.obj.dkg) - TRICK_EXPECT_NEAR( test , 20, 0.0001, test_suite , "float" ) - -###################################################################################################################### - - # Typedefed integers - test_suite = "typedef" - - ball.obj.i = 40 - ball.obj.iii = ball.obj.i - ball.obj.aiii = ball.obj.iii - - TRICK_EXPECT_EQ( ball.obj.iii , 40, test_suite , "integer from integer" ) - trick.trick_test_add_parent( test_suite , "integer from integer" , "1011083320") - TRICK_EXPECT_EQ( ball.obj.aiii , 40, test_suite , "integer from another typedefed integer" ) - trick.trick_test_add_parent( test_suite , "integer from another typedefed integer" , "1011083320") - -###################################################################################################################### - - test_suite = "structure" - - # Structs with more than one name - ball.t.i = 300 - TRICK_EXPECT_EQ( ball.t.i , 300, test_suite , "multi named structure no unit assignment" ) - - ball.t.i = trick.attach_units("in", 300) - TRICK_EXPECT_EQ( ball.t.i , 7, test_suite , "multi named structure with unit assignment" ) - - ball.t.d = 300 - TRICK_EXPECT_NEAR( ball.t.d , 300, 0.0001 , test_suite , "multi named structure no unit assignment" ) - - ball.t.d = trick.attach_units("in", 300) - TRICK_EXPECT_NEAR( ball.t.d , 7.62 , 0.0001 , test_suite , "multi named structure with unit assignment" ) - -###################################################################################################################### - - # Templates - test_suite = "template" - - # simple template - ball.obj.my_template_var.var1 = 30.0 - ball.obj.my_template_var.var2 = 40 - ball.obj.my_template_var.var3 = 50 - TRICK_EXPECT_NEAR( ball.obj.my_template_var.var1 , 30.0 , 0.000001 , test_suite , "double assignment" ) - TRICK_EXPECT_EQ( ball.obj.my_template_var.var2 , 40 , test_suite , "int assignment" ) - TRICK_EXPECT_EQ( ball.obj.my_template_var.var3 , 50 , test_suite , "short assignment" ) - trick.trick_test_add_parent( test_suite , "double assignment" , "2642836719") - trick.trick_test_add_parent( test_suite , "int assignment" , "2642836719") - trick.trick_test_add_parent( test_suite , "short assignment" , "2642836719") - - - # using typedef from within template - ball.obj.my_template_var_int = 66 - TRICK_EXPECT_EQ( ball.obj.my_template_var_int , 66, test_suite , "use typedef from within a template" ) - - # a more convoluted template - ball.obj.TTT_var.aa = 1000 - TRICK_EXPECT_EQ( ball.obj.TTT_var.aa , 1000, test_suite , "class complicated integer" ) - - ball.obj.TTT_var.bb = 2000.0 - TRICK_EXPECT_NEAR( ball.obj.TTT_var.bb , 2000, 0.0001, test_suite , "class complicated double" ) - -###################################################################################################################### - - # Namespace - test_suite = "namespace" - - ball.ns_test.mass = trick.attach_units("lbm", 10) - TRICK_EXPECT_NEAR( ball.ns_test.mass , 4.53592, 0.0001, test_suite , "Class variable with units" ) - trick.trick_test_add_parent( test_suite , "Class variable with units" , "2546878004") - - ball.ns_test.bbp = trick.alloc_type(2, "my_ns::BB") - ball.ns_test.bbp[0].str = "hello" - ball.ns_test.bbp[1].str = "there" - temp = ball.ns_test.bbp[0].str + " " + ball.ns_test.bbp[1].str - TRICK_EXPECT_EQ( str(temp) , "hello there", test_suite , "1D Class allocation" ) - trick.trick_test_add_parent( test_suite , "1D Class allocation" , "2546878004") - - ball.ns_test.bbpp = trick.alloc_type(4, "my_ns::BB *") - ball.ns_test.bbpp[0] = trick.alloc_type(3, "my_ns::BB") - ball.ns_test.bbpp[0][0].str = "bark" - ball.ns_test.bbpp[0][1].str = "meow" - ball.ns_test.bbpp[0][2].str = "quack" - temp = ball.ns_test.bbpp[0][0].str + " " + ball.ns_test.bbpp[0][1].str + " " + ball.ns_test.bbpp[0][2].str - TRICK_EXPECT_EQ( str(temp) , "bark meow quack", test_suite , "2D Class allocation" ) - trick.trick_test_add_parent( test_suite , "2D Class allocation" , "2546878004") - -###################################################################################################################### - - # Miscellaneous - test_suite = "misc" - - ball.obj.d = 10 - ball.obj.ds = 15 - temp = ball.obj.d + float(ball.obj.ds) - TRICK_EXPECT_NEAR( temp , 25 , 0.0001 , test_suite , "Forced remove units" ) - trick.trick_test_add_parent( test_suite , "Forced remove units" , "3339258059") - - temp = [ ball.obj.d , ball.obj.ds ] - TRICK_EXPECT_EQ( str(temp) , "[10 kg, 15 s]", test_suite , "List with different objects" ) - - ball.obj.dp = trick.get_address("ball.obj.d") - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[10 kg]", test_suite , "Get address" ) - - ball.obj.d += 1 - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[11 kg]", test_suite , "Get address verification" ) - - ball.obj.da[2] = 45 - ball.obj.dp = trick.get_address("ball.obj.da[2]") - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[45 kg]", test_suite , "Get address mid-array" ) - - ball.obj.dp = trick.get_address("ball.obj.daa[1][1]") - TRICK_EXPECT_EQ( str(ball.obj.dp) , "[60 kg]", test_suite , "Get address multi-dimensional mid-array" ) - - temp_array = ball.obj.daa[1] - TRICK_EXPECT_EQ( str(temp_array) , "[50.1 kg, 60 kg, 52.3 kg]", test_suite , "Local variable reference to array" ) - - # "const int & cir" and "int const & icr" are pointed to i in the Ball_alex constructor - ball.obj.i = 55 - TRICK_EXPECT_EQ( ball.obj.cir , 55, test_suite , "Const reference" ) - TRICK_EXPECT_EQ( ball.obj.icr , 55, test_suite , "Const reference" ) - - #ball.obj.cir = 99 - #TRICK_EXPECT_EQ( ball.obj.cir , 55, test_suite , "Const reference immutable test 1" ) - #TRICK_EXPECT_EQ( ball.obj.icr , 55, test_suite , "Const reference immutable test 1" ) - - #ball.obj.icr = 98 - #TRICK_EXPECT_EQ( ball.obj.cir , 55, test_suite , "Const reference immutable test 2" ) - #TRICK_EXPECT_EQ( ball.obj.icr , 55, test_suite , "Const reference immutable test 2" ) - - ball.obj.iiia = [ 300 , 400 , 500 , 600 , 700 ] - TRICK_EXPECT_EQ( str(ball.obj.iiia) , "[300, 400, 500, 600, 700, 0]", test_suite , "Typedeffed integer type" ) - - # scd = static const double, csd = const static double, sdc = static double const - TRICK_EXPECT_NEAR( ball.obj.scd , 1.2345 , 0.0001 , test_suite , "Static const access" ) - TRICK_EXPECT_NEAR( ball.obj.csd , 6.7890 , 0.0001 , test_suite , "Static const access" ) - TRICK_EXPECT_NEAR( ball.obj.sdc , 9.8765 , 0.0001 , test_suite , "Static const access" ) - - # Attempt to change a static const double - #ball.obj.scd = 90.0 ; - #TRICK_EXPECT_NEAR( ball.obj.scd , 1.2345 , 0.0001 , test_suite , "Static const immutable test 1" ) - #trick_mm.mmw.mm.read_checkpoint_from_string("ball.obj.scd = 2.2222 ;") - #TRICK_EXPECT_NEAR( ball.obj.scd , 1.2345 , 0.0001 , test_suite , "Static const immutable test 2" ) - #ball.obj.csd = 90.0 ; - #TRICK_EXPECT_NEAR( ball.obj.csd , 6.7890 , 0.0001 , test_suite , "Static const immutable test 3" ) - #trick_mm.mmw.mm.read_checkpoint_from_string("ball.obj.csd = 2.2222 ;") - #TRICK_EXPECT_NEAR( ball.obj.csd , 6.7890 , 0.0001 , test_suite , "Static const immutable test 4" ) - #ball.obj.sdc = 90.0 ; - #TRICK_EXPECT_NEAR( ball.obj.sdc , 9.8765 , 0.0001 , test_suite , "Static const immutable test 5" ) - #trick_mm.mmw.mm.read_checkpoint_from_string("ball.obj.sdc = 2.2222 ;") - #TRICK_EXPECT_NEAR( ball.obj.sdc , 9.8765 , 0.0001 , test_suite , "Static const immutable test 6" ) - - tester = trick.Test() - output = tester.foo() - TRICK_EXPECT_EQ( output , "called foo", test_suite , "Instantiate class and capture return value" ) - - tester.t = trick.Test() - output = tester.t.foo() - TRICK_EXPECT_EQ( output , "called foo", test_suite , "Instantiate class pointer within class and capture return value" ) - -###################################################################################################################### - - # Standard typedeffed integer types - test_suite = "typedef_ints" - - ball.obj.i8t = 70 ; - TRICK_EXPECT_EQ( ball.obj.i8t , 70, test_suite , "int8_t" ) - trick.trick_test_add_parent( test_suite , "int8_t" , "2939597198") - - ball.obj.ui8t = 71 ; - TRICK_EXPECT_EQ( ball.obj.ui8t , 71, test_suite , "uint8_t" ) - - ball.obj.i16t = 80 ; - TRICK_EXPECT_EQ( ball.obj.i16t , 80, test_suite , "int16_t" ) - - ball.obj.ui16t = 81 ; - TRICK_EXPECT_EQ( ball.obj.ui16t , 81, test_suite , "uint16_t" ) - - ball.obj.i32t = 90 ; - TRICK_EXPECT_EQ( ball.obj.i32t , 90, test_suite , "int32_t" ) - - ball.obj.ui32t = 91 ; - TRICK_EXPECT_EQ( ball.obj.ui32t , 91, test_suite , "uint32_t" ) - - ball.obj.i64t = 100 ; - TRICK_EXPECT_EQ( ball.obj.i64t , 100, test_suite , "int64_t" ) - - ball.obj.ui64t = 101 ; - TRICK_EXPECT_EQ( ball.obj.ui64t , 101, test_suite , "uint64_t" ) - - ball.obj.sizet = 111 ; - TRICK_EXPECT_EQ( ball.obj.sizet , 111, test_suite , "size_t" ) - - ball.obj.u_c = 121 ; - TRICK_EXPECT_EQ( ball.obj.u_c , 121, test_suite , "u_char" ) - - ball.obj.u_s = 131 ; - TRICK_EXPECT_EQ( ball.obj.u_s , 131, test_suite , "u_short" ) - - ball.obj.u_i = 141 ; - TRICK_EXPECT_EQ( ball.obj.u_i , 141, test_suite , "u_int" ) - - ball.obj.u_l = 151 ; - TRICK_EXPECT_EQ( ball.obj.u_l , 151, test_suite , "u_long" ) - - ball.obj.q = 161 ; - TRICK_EXPECT_EQ( ball.obj.q , 161, test_suite , "quad_t" ) - - ball.obj.uq = 171 ; - TRICK_EXPECT_EQ( ball.obj.uq , 171, test_suite , "u_quad_t" ) - -###################################################################################################################### - - # Exceptions - - test_suite = "exception" - - test_case = "Array index out of bounds" - try: - ball.obj.da[5] = 2.0 - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "Double dimension array first index out of bounds" - try: - ball.obj.daa[20][0] = 2.0 - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "Double dimension array second index out of bounds" - try: - ball.obj.daa[0][20] = 2.0 - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "String too long" - try: - ball.obj.ca = "dfjdslfjdsajfldjalfjdslafjdlsajfdsd" - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "Units mismatch" - try: - ball.obj.da[2] = trick.attach_units("s" , 2.0) - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "unit-ed value assigned to unitless variable" - try: - ball.obj.dno_units = trick.attach_units("in" , 60.6) - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "unit-ed value assigned to unitless integer array variable" - try: - ball.obj.ia = trick.attach_units("in" , [60, 70]) - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - - test_case = "unit-ed value assigned to unitless integer pointer variable" - try: - ball.obj.ip = trick.attach_units("in" , [60, 70]) - trick.add_test_result( test_suite , test_case , "TRICK_EXPECT_EXCEPTION not tripped") - except: - trick.add_test_result( test_suite , test_case , "") - -###################################################################################################################### - - # Polymorphic assignments and access - test_suite = "polymorphism" - - ball.a = trick.Cat() - TRICK_EXPECT_EQ( ball.a.id , 1, test_suite , "single abstract ptr" ) - trick.trick_test_add_parent( test_suite , "single abstract ptr" , "1770735610") - #ball.a.speak() - #ball.a[0].speak() - ball.a = trick.Dog() - TRICK_EXPECT_EQ( ball.a.id , 2, test_suite , "single abstract ptr" ) - - ball.aarray[0] = trick.Cat() - ball.aarray[1] = trick.Dog() - ids = [ ball.aarray[0].id , ball.aarray[1].id ] - TRICK_EXPECT_EQ( str(ids), "[1, 2]", test_suite , "fixed array of abstract ptrs" ) - #ball.aarray[0].speak() - #ball.aarray[1].speak() - - ball.alist = trick.TMM_declare_var_1d("Abstract *", 4) - - ball.alist[0] = trick.TMM_declare_var_s("Cat") - ball.alist[1] = trick.TMM_declare_var_s("Dog") - ball.alist[2] = trick.Cat() - ball.alist[3] = trick.Dog() - ids = [ ball.alist[0].id , ball.alist[1].id , ball.alist[2].id , ball.alist[3].id ] - TRICK_EXPECT_EQ( str(ids), "[1, 2, 1, 2]", test_suite , "fixed array of abstract ptrs" ) - #ball.alist[0].speak() - #ball.alist[1].speak() - #ball.alist[2].speak() - #ball.alist[3].speak() - - # test vector of abstract pointers - new_cat = trick.TMM_declare_var(trick.TRICK_STRUCTURED,"Cat",0,"my_cat",0,None) - ball.vap.push_back(new_cat) - TRICK_EXPECT_EQ( ball.vap[0].id , 1, test_suite , "std::vector of abstract ptrs" ) - - new_dog = trick.TMM_declare_var(trick.TRICK_STRUCTURED,"Dog",0,"my_dog",0,None) - ball.vap.push_back(new_dog) - TRICK_EXPECT_EQ( ball.vap[1].id , 2, test_suite , "std::vector of abstract ptrs" ) - - #ball.vap[0].speak() - #ball.vap[1].speak() - - #drg0 = trick.DRAscii("cat_stuff") - #drg0.add_variable("my_cat.id") - #drg0.add_variable("my_dog.id") - #drg0.set_cycle(0.1) - #drg0.freq = trick.DR_Always - #drg0.thisown = 0 - #trick.add_data_record_group(drg0, trick.DR_Buffer) - - ball.vap2.push_back(new_dog) - ball.vap2.push_back(new_cat) - - # vector of vectors (experimental. It does work!) - ball.vvap.push_back(ball.vap) - ball.vvap.push_back(ball.vap2) - #ball.vvap[0][0].speak() - #ball.vvap[0][1].speak() - #ball.vvap[1][0].speak() - #ball.vvap[1][1].speak() - -###################################################################################################################### - - test_suite = "array_sclicing" - - # fixed array - ball.obj.ia = [ 10 , 20 , 30 ] - TRICK_EXPECT_EQ( str(ball.obj.ia[:]), "[10, 20, 30]", test_suite , "full slice, fixed array" ) - TRICK_EXPECT_EQ( str(ball.obj.ia[1:]), "[20, 30]", test_suite , "slice with start value, fixed array" ) - TRICK_EXPECT_EQ( str(ball.obj.ia[:2]), "[10, 20]", test_suite , "slice with end value, fixed array" ) - TRICK_EXPECT_EQ( str(ball.obj.ia[::2]), "[10, 30]", test_suite , "sclice with step value, fixed array" ) - TRICK_EXPECT_EQ( str(ball.obj.ia[-3:-1]), "[10, 20]", test_suite , "slice with negative start and end value, fixed array" ) - TRICK_EXPECT_EQ( str(ball.obj.ia[::-2]), "[30, 10]", test_suite , "slice with negative step, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[1:1] = 400 - TRICK_EXPECT_EQ( str(ball.obj.ia), "[10, 400, 20]", test_suite , "slice insertion with scalar value, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[1:1] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ia), "[10, 400, 500]", test_suite , "slice insertion of list, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[1:2] = 400 - TRICK_EXPECT_EQ( str(ball.obj.ia), "[10, 400, 30]", test_suite , "slice replacement with scalar value, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[0:1] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ia), "[400, 500, 20]", test_suite , "slice replacement list larger than sclice, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[0:2] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ia), "[400, 500, 30]", test_suite , "slice replacement list same size as sclice, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[0:3] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ia), "[400, 500, 0]", test_suite , "slice replacement list smaller than slice, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[:] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ia), "[400, 500, 0]", test_suite , "slice replacement full array, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[0:2:2] = 400 - TRICK_EXPECT_EQ( str(ball.obj.ia), "[400, 20, 30]", test_suite , "slice replacement with scalar and step, fixed array" ) - - ball.obj.ia = [ 10 , 20 , 30] - ball.obj.ia[0:3:2] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ia), "[400, 20, 500]", test_suite , "slice replacement with list and step, fixed array" ) - - # pointer - ball.obj.ip = [ 10 , 20 , 30 , 40 ] - TRICK_EXPECT_EQ( str(ball.obj.ip[:]), "[10, 20, 30, 40]", test_suite , "full slice, pointer" ) - TRICK_EXPECT_EQ( str(ball.obj.ip[1:]), "[20, 30, 40]", test_suite , "slice with start value, pointer" ) - TRICK_EXPECT_EQ( str(ball.obj.ip[:2]), "[10, 20]", test_suite , "slice with end value, pointer" ) - TRICK_EXPECT_EQ( str(ball.obj.ip[::2]), "[10, 30]", test_suite , "sclice with step value, pointer" ) - TRICK_EXPECT_EQ( str(ball.obj.ip[-3:-1]), "[20, 30]", test_suite , "slice with negative start and end value, pointer" ) - TRICK_EXPECT_EQ( str(ball.obj.ip[::-2]), "[40, 20]", test_suite , "slice with negative step, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:1] = 400 - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 20, 30, 40]", test_suite , "slice insertion with scalar value, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:1] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 500, 20, 30]", test_suite , "slice insertion of list, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:2] = 400 - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 30, 40, 50]", test_suite , "slice replacement with scalar value, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:2] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 500, 30, 40]", test_suite , "slice replacement list larger than sclice, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:3] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 500, 40, 50]", test_suite , "slice replacement list same size as sclice, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:4] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 500, 50, 0]", test_suite , "slice replacement list smaller than slice, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[:] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[400, 500, 0, 0, 0]", test_suite , "slice replacement full array, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:3:2] = 400 - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 30, 40, 50]", test_suite , "slice replacement with scalar and step, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:4:2] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 30, 500, 50]", test_suite , "slice replacement with list and step, pointer" ) - - ball.obj.ip = [ 10 , 20 , 30 , 40 , 50] - ball.obj.ip[1:5:2] = [400 , 500] - TRICK_EXPECT_EQ( str(ball.obj.ip), "[10, 400, 30, 500, 50]", test_suite , "slice replacement with list and step, pointer" ) - -###################################################################################################################### - - test_suite = "STL list support" - - #print dir(ball.obj.ls) - - TRICK_EXPECT_EQ( ball.obj.ls.empty(), 1, test_suite , "STL list empty true" ) - ball.obj.ls.push_back('string 1') - ball.obj.ls.push_front('string 2') - ball.obj.ls.push_back('string 3') - TRICK_EXPECT_EQ( ball.obj.ls.empty(), 0, test_suite , "STL list empty false" ) - TRICK_EXPECT_EQ( ball.obj.ls.front(), "string 2", test_suite , "STL list front access" ) - TRICK_EXPECT_EQ( ball.obj.ls.back(), "string 3", test_suite , "STL list back access" ) - TRICK_EXPECT_EQ( ball.obj.ls.size(), 3, test_suite , "STL list size command" ) - - #ball.obj.ls.insert(ball.obj.ls.begin(), 'string 4') - #ball.obj.ls.pop_front() - #ball.obj.ls.erase(ball.obj.ls.begin()) - #for l in ball.obj.ls: - # print l - -###################################################################################################################### - - test_suite = "STL map support" - - TRICK_EXPECT_EQ( ball.obj.msi.empty(), 1, test_suite , "STL map empty true" ) - - ball.obj.msi['key1'] = 50 - ball.obj.msi['key2'] = 60 - ball.obj.msi['key3'] = 70 - - TRICK_EXPECT_EQ( ball.obj.msi.empty(), 0, test_suite , "STL map empty false" ) - TRICK_EXPECT_EQ( ball.obj.msi['key1'], 50, test_suite , "STL map key/data insertion/access" ) - TRICK_EXPECT_EQ( str(ball.obj.msi.keys()), "['key1', 'key2', 'key3']", test_suite , "STL map keys command" ) - TRICK_EXPECT_EQ( str(ball.obj.msi.values()), "[50, 60, 70]", test_suite , "STL map values command" ) - TRICK_EXPECT_EQ( ball.obj.msi.has_key('key1'), 1, test_suite , "STL map has_key true" ) - TRICK_EXPECT_EQ( ball.obj.msi.has_key('key4'), 0, test_suite , "STL map has_key false" ) - TRICK_EXPECT_EQ( ball.obj.msi.size(), 3, test_suite , "STL map size command" ) - #print dict(ball.obj.msi) - -###################################################################################################################### - - test_suite = "Templated SimObject" - - TRICK_EXPECT_EQ( tso.t, 25, test_suite , "templated sim_object access member" ) - TRICK_EXPECT_EQ( iftso.t, 25, test_suite , "inherit from templated sim_object access member" ) - -###################################################################################################################### - - test_suite = "Templated SimObject" - TRICK_EXPECT_TRUE( ball.test_true(), test_suite , "boolean function return" ) - TRICK_EXPECT_FALSE( ball.test_false(), test_suite , "boolean function return" ) - -###################################################################################################################### - -if __name__ == "__main__": - main() - diff --git a/trick_sims/SIM_test_ip/S_overrides.mk b/trick_sims/SIM_test_ip/S_overrides.mk deleted file mode 100644 index 09814dd2..00000000 --- a/trick_sims/SIM_test_ip/S_overrides.mk +++ /dev/null @@ -1,4 +0,0 @@ -TRICK_ICG_EXCLUDE=${TRICK_HOME}/trick_models/exclude_me -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models -#TRICK_CONVERT_SWIG_FLAGS += -s diff --git a/trick_sims/SIM_test_templates/S_overrides.mk b/trick_sims/SIM_test_templates/S_overrides.mk deleted file mode 100644 index 8fa02be5..00000000 --- a/trick_sims/SIM_test_templates/S_overrides.mk +++ /dev/null @@ -1,4 +0,0 @@ - -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models - diff --git a/trick_sims/makefile b/trick_sims/makefile index b44c1b9b..1acc4d87 100644 --- a/trick_sims/makefile +++ b/trick_sims/makefile @@ -19,7 +19,6 @@ COMPILE_DIRS = SIM_Ball++_L1 \ SIM_demo_sdefine \ SIM_events \ SIM_monte \ - SIM_rti \ SIM_satellite \ SIM_stls \ SIM_stls2 \ @@ -30,11 +29,9 @@ COMPILE_DIRS = SIM_Ball++_L1 \ SIM_test_dp \ SIM_test_dr \ SIM_test_inherit \ - SIM_test_ip \ SIM_test_ip2 \ SIM_test_sched \ SIM_test_simlib \ - SIM_test_templates \ SIM_threads \ SIM_threads_simple \ SIM_trickcomm @@ -59,17 +56,14 @@ TEST_DIRS = SIM_Ball++_L1 \ SIM_demo_sdefine \ SIM_events \ SIM_monte \ - SIM_rti \ SIM_stls \ SIM_stls2 \ SIM_sun \ SIM_target \ SIM_test_dp \ SIM_test_dr \ - SIM_test_ip \ SIM_test_sched \ SIM_test_simlib \ - SIM_test_templates \ SIM_threads # This test is temporarily sitting out until fixed.