int main(void) { test_float("[0.1234]"); test_float("[1.0000000]"); test_float("[0.9999]"); test_float("[0.01]"); test_float("[000.01]"); return 0; }
static int test_floats(void) { plan(27); header(); test_float((float) 1.0, "\xca\x3f\x80\x00\x00", 5); test_float((float) 3.141593, "\xca\x40\x49\x0f\xdc", 5); test_float((float) -1e38f, "\xca\xfe\x96\x76\x99", 5); footer(); return check_plan(); }
void Test_Variant::run() { test_int(); test_float(); test_double(); test_string(); }
int test() { int Error(0); Error += test_float(); return Error; }
int main () { test_float (); test_double (); test_long_double (); return 0; }
int main(void) { test_gprmc2(&pq_obj); test_gpgga(&pq_obj); test_sentence(&pq_obj); test_gprmc(&pq_obj); test_str(&pq_obj); test_float(&pq_obj); }
TEST(test_encode_decode, test_float) { test_float(3.14159265359f, "db0f4940"); test_float(-1.0f, "000080bf"); test_float(0.0f, "00000000"); test_float(std::numeric_limits<float>::infinity(), "0000807f"); test_float(-std::numeric_limits<float>::infinity(), "000080ff"); test_float(std::numeric_limits<float>::quiet_NaN(), "0000c07f"); test_float(std::numeric_limits<float>::signaling_NaN(), "0000a07f"); }
// Types can be defined in constexpr functions. constexpr int f() { enum E { e1, e2, e3 }; struct S { constexpr S(E e) : e(e) {} constexpr int get() { return e; } E e; }; return S(e2).get(); }
static void do_test() { test_bitmap(); test_dmfont(); test_realtime(); test_mm(); test_bezier(); test_ttf(); test_float(); test_keyboard(); }
int main() { test_char(); test_uchar(); test_short(); test_ushort(); test_int(); test_uint(); test_long(); test_ulong(); test_float(); test_double(); return 0; }
int main (void) { err = 0; test_float (); test_double (); test_long_double (); test_int (); test_long_int (); if (err != 0) abort (); return 0; }
/* test on random values (but relatively small) */ static int test_2 (void) { guint i; guint n_success = 0; for (i = 0; i < 100000; i++) { if (test_float (g_random_int_range (-100000, 100000), g_random_int_range (0, 999999999))) { n_success ++; } } g_debug ("%d/%d tests suceeded (%.2f%%)", n_success, i, PERCENT (i, n_success)); return n_success == i ? 0 : 1; }
int main () { test_float (); test_double (); { DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); test_long_double (); END_LONG_DOUBLE_ROUNDING (); } return 0; }
void proc_main_task(s32 taskId) { s32 ret; u32 cnt = 0; char Buff[10]="0.345"; char* pStr; // Register & open UART port ret = Ql_UART_Register(UART_PORT1, CallBack_UART_Hdlr, NULL); if (ret < QL_RET_OK) { Ql_Debug_Trace("Fail to register serial port[%d], ret=%d\r\n", UART_PORT1, ret); } ret = Ql_UART_Open(UART_PORT1, 115200, FC_NONE); if (ret < QL_RET_OK) { Ql_Debug_Trace("Fail to open serial port[%d], ret=%d\r\n", UART_PORT1, ret); } APP_DEBUG("OpenCPU: float test !\r\n\r\n"); /* Print out message through DEBUG port */ test_float(); test_dis(); // Start message loop of this task while (TRUE) { Ql_OS_GetMessage(&msg); switch(msg.message) { case MSG_ID_USER_START: break; default: break; } } Ql_MEM_Free(pStr); }
/* test many really small (-1.0, +1.0) values */ static int test_1 (void) { glong m; glong d; int ret = 0; #define M_MIN -1 #define M_MAX +1 #define M_STEP 1 #define D_MIN 0 #define D_MAX +10000000 #define D_STEP 1111 for (m = M_MIN; m < M_MAX; m += M_STEP) { for (d = D_MIN; d < D_MAX; d += D_STEP) { if (! test_float (m, d)) { ret = 1; } } } return ret; }
int test_sparse_vector() { starting_tests(); learner_error error; SparseVector *v1, *v2; // create a generic matrix Matrix *m; error = matrix_new(&m); // creating error = sparse_vector_new(&v1, m); test_error(error); error = sparse_vector_new(&v2, m); test_error(error); // setting test_set_value(v1, 1, 2.0); test_set_value(v1, 0, 1.0); test_set_value(v2, 0, 3.0); test_set_value(v2, 3, 4.0); test_set_value(v2, 2, 5.0); // getting float value; test_get_value(v1, 0, 1.0); test_get_value(v1, 1, 2.0); test_get_value(v2, 0, 3.0); test_get_value(v2, 2, 5.0); test_get_value(v2, 3, 4.0); // freezing int frozen; error = sparse_vector_freeze(v1); test_error(error); error = sparse_vector_freeze(v2); test_error(error); error = sparse_vector_frozen(v1, &frozen); test_error(error); test(frozen); error = sparse_vector_frozen(v2, &frozen); test_error(error); test(frozen); // magnitude error = sparse_vector_magnitude(v1, &value); test_error(error); test_float(value, sqrtf(5.0)); error = sparse_vector_magnitude(v2, &value); test_error(error); test_float(value, sqrtf(50.0)); // euclidean distance error = sparse_vector_euclidean_distance(v1, v2, &value); test_error(error); test_float(value, sqrtf(4.0 + 4.0 + 25.0 + 16.0)); // dot product error = sparse_vector_dot_product(v1, v2, &value); test_error(error); test_float(value, 3.0); // cosine similarity error = sparse_vector_cosine_similarity(v1, v2, &value); test_error(error); test_float(value, ((3.0) / (sqrtf(5.0) * sqrtf(50.0)))); // setting existing values test_set_value(v1, 1, 12.0); test_set_value(v1, 0, 11.0); test_set_value(v2, 0, 13.0); test_set_value(v2, 3, 14.0); test_set_value(v2, 2, 15.0); // getting changed values test_get_value(v1, 0, 11.0); test_get_value(v1, 1, 12.0); test_get_value(v2, 0, 13.0); test_get_value(v2, 2, 15.0); test_get_value(v2, 3, 14.0); // cleanup error = sparse_vector_free(v1); test_error(error); error = sparse_vector_free(v2); test_error(error); finished_tests(); }
void selftest(void) { // for handling "errout" if (setjmp(jbuf)) return; #if SELFTEST test_low_level(); test_multiply(); test_scan(); test_power(); test_factor_number(); test_test(); test_tensor(); test_bake(); test(__FILE__, s, sizeof (s) / sizeof (char *)); // "s" is in selftest.h test_abs(); test_adj(); test_arg(); test_besselj(); test_bessely(); test_ceiling(); test_choose(); test_circexp(); test_clock(); test_cofactor(); test_condense(); test_contract(); test_defint(); test_denominator(); test_derivative(); test_dirac(); test_erf(); test_erfc(); test_expand(); test_expcos(); test_expsin(); test_factorpoly(); test_float(); test_floor(); test_gamma(); test_gcd(); test_imag(); test_inner(); test_lcm(); test_log(); test_mag(); test_mod(); test_nroots(); test_numerator(); test_outer(); test_polar(); test_quotient(); test_rationalize(); test_real(); test_rect(); test_sgn(); test_taylor(); test_transpose(); test_zero(); test_hermite(); test_laguerre(); test_legendre(); test_binomial(); test_divisors(); test_coeff(); test_sin(); test_cos(); test_tan(); test_sinh(); test_cosh(); test_tanh(); test_arcsin(); test_arcsinh(); test_arccos(); test_arccosh(); test_arctan(); test_arctanh(); test_index(); test_isprime(); test_integral(); test_simplify(); test_roots(); test_eigen(); #endif mini_test(); logout("OK, all tests passed.\n"); }
int main( int argc , char ** argv) { test_int(); test_double(); test_float(); exit(0); }
void piglit_init(int argc, char **argv) { bool pass = true; int gl_version; int glsl_major; int glsl_minor; int glsl_version; const char *version_for_float_shader = NULL; const char *version_for_double_shader = NULL; const char *version_for_int_shader = NULL; GLint context_flags = 0; piglit_require_vertex_shader(); piglit_require_extension("GL_ARB_separate_shader_objects"); gl_version = piglit_get_gl_version(); if (gl_version >= 30) glGetIntegerv(GL_CONTEXT_FLAGS, &context_flags); piglit_get_glsl_version(NULL, &glsl_major, &glsl_minor); glsl_version = (glsl_major * 100) + glsl_minor; /* Select a shading language version string based on the GL version * and whether or not we're running in a core profile. */ switch (gl_version / 10) { case 1: case 2: /* Selecting 1.20 will enable the non-square matrix tests. */ version_for_float_shader = (glsl_version >= 120) ? "#version 120\n" : "#version 110\n"; if (glsl_version >= 130) version_for_int_shader = "#version 130\n"; break; case 3: /* OpenGL 3.0 deprecated GLSL 1.10 and 1.20. OpenGL 3.1 * removed almost all deprecated features. * Forworad-compatible contexts remove all deprecated * features. */ if (gl_version == 30) { version_for_float_shader = (context_flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) ? "#version 130\n" : "#version 120\n"; version_for_int_shader = "#version 130\n"; } else { /* Section 1.6.1 (OpenGL Shading Language) of the * OpenGL 3.1 spec says: * * "OpenGL 3.1 implementations are guaranteed to * support at least version 1.30 of the shading * language." * * This is likely a copy-and-paste error from version * 3.0. This should be 1.40. * * Section 1.6.1 (OpenGL Shading Language) of the * OpenGL 3.2 spec says: * * "OpenGL 3.2 implementations are guaranteed to * support versions 1.40 and 1.50 of the OpenGL * Shading Language." * * Section 1.7.1 (OpenGL Shading Language) of the * OpenGL 3.3 spec says: * * "OpenGL 3.3 implementations are guaranteed to * support version 3.30 of the OpenGL Shading * Language." * * Based on all of this, pick version 1.40 for OpenGL * versions before 3.3, and version 3.30 for version * 3.3. */ if (gl_version < 33) { version_for_float_shader = "#version 140\n"; version_for_int_shader = "#version 140\n"; } else { version_for_float_shader = "#version 330 core\n"; version_for_int_shader = "#version 330 core\n"; } if (piglit_is_extension_supported("GL_ARB_gpu_shader_fp64")) { /* The GL_ARB_gpu_shader_fp64 extensions spec * says: * * "OpenGL 3.2 and GLSL 1.50 are required." */ version_for_double_shader = "#version 150 core\n" "#extension GL_ARB_gpu_shader_fp64: require\n" ; } } break; case 4: /* Section 1.7.1 (OpenGL Shading Language) of the * OpenGL 4.0 spec says: * * "OpenGL 4.0 implementations are guaranteed to support * version 4.00 of the OpenGL Shading Language." * * Section 1.7.1 (OpenGL Shading Language) of the * OpenGL 4.1 spec says: * * "OpenGL 4.1 implementations are guaranteed to support * version 4.10 of the OpenGL Shading Language." * * Section 1.7.1 (OpenGL Shading Language) of the * OpenGL 4.2 spec says: * * "OpenGL 4.2 implementations are guaranteed to support * version 4.20 of the OpenGL Shading Language....The core * profile of OpenGL 4.2 is also guaranteed to support all * previous versions of the OpenGL Shading Language back * to version 1.40." * * Section 1.3.1 (OpenGL Shading Language) of the * OpenGL 4.3 spec says: * * "OpenGL 4.3 implementations are guaranteed to support * version 4.30 of the OpenGL Shading Language....The core * profile of OpenGL 4.3 is also guaranteed to support all * previous versions of the OpenGL Shading Language back * to version 1.40." * * Section 1.3.1 (OpenGL Shading Language) of the * OpenGL 4.4 spec says: * * "OpenGL 4.4 implementations are guaranteed to support * version 4.40 of the OpenGL Shading Language....The core * profile of OpenGL 4.4 is also guaranteed to support all * previous versions of the OpenGL Shading Language back * to version 1.40." * * Even though 4.1 doesn't say anything about GLSL 4.00, the * inference is that the addition starting in 4.2 was a * clarification. */ version_for_float_shader = "#version 400 core\n"; version_for_double_shader = "#version 400 core\n"; version_for_int_shader = "#version 400 core\n"; break; default: fprintf(stderr, "Unknown GL version!\n"); piglit_report_result(PIGLIT_FAIL); } pass = test_float(version_for_float_shader) && pass; pass = test_square_mat(version_for_float_shader) && pass; pass = test_nonsquare_mat(version_for_float_shader) && pass; pass = test_int(version_for_int_shader) && pass; pass = test_uint(version_for_int_shader) && pass; pass = test_double(version_for_double_shader) && pass; pass = test_dmat(version_for_double_shader) && pass; piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
DEFINE_THREAD_ROUTINE(main_application_thread, data) { /* Mutexes for synchronisation */ vp_os_mutex_init(&test_mutex); vp_os_cond_init(&test_condition,&test_mutex); vp_os_delay(1000); //fflush(stdin); printf("[IMPORTANT] Please check you deleted all configuration files on the drone before starting.\n"); printf("\n Resetting the drone to the default configuration \n"); /* Switch to the default configuration file */ /* Always start by setting the session, then the application, then the user */ set_string(session_id,"00000000"); set_string(application_id,"00000000"); set_string(profile_id,"00000000"); /* Suppress all other settings. A session and an application were automatically created * at application startup by ARDrone Tool ; we must delete them. * The '-' symbol means 'delete'. * '-all' deletes all the existing configurations. */ set_string(session_id,"-all"); set_string(application_id,"-all"); set_string(profile_id,"-all"); set_int(navdata_demo,1); mypause(); /* Ask the drone configuration and compare it to the expected values */ /* Send time to the drone */ //gettimeofday(&tv,NULL); //set_int(time,(int32_t)tv.tv_sec); title("\nGetting the drone configuration ...\n"); ARDRONE_TOOL_CONFIGURATION_GET(test_callback); vp_os_cond_wait(&test_condition); title("Comparing received values to the config_keys.h defaults ...\n"); #define ARDRONE_CONFIG_KEY_IMM_a9(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK,SCOPE) \ test_float(NAME,DEFAULT); #undef ARDRONE_CONFIG_KEY_REF_a9 #define ARDRONE_CONFIG_KEY_STR_a9(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK,SCOPE) \ test_string(NAME,DEFAULT); #include <config_keys.h> /* Modify one value of each category and see what happens */ /* To test the 'COMMON' category */ set_string(ardrone_name,"TEST_CONFIG"); /* To test the 'APPLIS' category */ test_nint(bitrate_ctrl_mode,1); /* 0 is the default value */ set_int(bitrate_ctrl_mode,1); /* To test the 'PROFILE' (aka. 'USER') category */ test_nfloat(outdoor_euler_angle_max,F1); set_float(outdoor_euler_angle_max,F1); /* To test the 'SESSION' category */ test_string(leds_anim,"0,0,0"); set_string(leds_anim,"1,1,1"); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); title("\nGetting the drone configuration ...\n"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); /* CAT_COMMON param */ test_int(bitrate_ctrl_mode,1); /* CAT_APPLI param */ test_float(outdoor_euler_angle_max,F1); /* CAT_USER param */ test_string(leds_anim,"1,1,1"); /* CAT_SESSION param */ test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); /*---------------------------------------------------------------------------------------------------------*/ /* Create an application configuration file */ title("\nCreating the application ID 11111111 ...\n"); set_string(application_id,"11111111"); set_string(application_desc,APPDESC1); title("\nGetting the drone configuration ...\n"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); /* CAT_COMMON param; its value should not be changed by creating an application config. */ test_int(bitrate_ctrl_mode,0); /* 0 is the default value ; default values are affected to newly created configurations */ test_float(outdoor_euler_angle_max,F1); /* CAT_USER param ; its value should not be changed by creating an application config. */ test_int(detect_type,CAD_TYPE_NONE); /* CAT_SESSION param; its value should not be changed by creating an application config. */ test_string(application_id,"11111111"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc,APPDESC1); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); set_int(bitrate_ctrl_mode,1); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); set_int(bitrate_ctrl_mode,0); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,0); mypause(); title("\nGoing back to the default application configuration ...\n"); set_string(application_id,"00000000"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); /* 1 was the value of the config.ini configuration */ test_float(outdoor_euler_angle_max,F1); test_int(detect_type,CAD_TYPE_NONE); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc,DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); mypause(); title(" Going back to the newly created application configuration ...\n"); set_string(application_id,"11111111"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,0); test_float(outdoor_euler_angle_max,F1); test_int(detect_type,CAD_TYPE_NONE); test_string(application_id,"11111111"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , APPDESC1); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); set_string(application_id,"00000000"); mypause(); /*-----------------------------------------------------------------------------------------------*/ /* Create a user profile configuration file */ title("\nCreating the user profile ID 22222222 ...\n"); set_string(profile_id,"22222222"); set_string(profile_desc,PROFDESC2); title("\nGetting the drone configuration ...\n"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); /* 1 was the value of the config.ini configuration */ test_float(outdoor_euler_angle_max,default_outdoor_euler_angle_ref_max); test_int(detect_type,CAD_TYPE_NONE); test_string(application_id,"00000000"); test_string(profile_id,"22222222"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, PROFDESC2);//DEFAULT_PROFILE_DESC test_string(session_desc, DEFAULT_SESSION_DESC); set_float(outdoor_euler_angle_max,F2); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} mypause(); title("\nGoing back to the default user profile configuration ...\n"); set_string(profile_id,"00000000"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} /* The default value for this is 1 after the first test */ test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); /* 1 was the value of the config.ini configuration */ test_float(outdoor_euler_angle_max,F1); test_int(detect_type,CAD_TYPE_NONE); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); mypause(); title(" Going back to the newly created user profile configuration ...\n"); set_string(profile_id,"22222222"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); /* 1 was the value of the config.ini configuration */ test_float(outdoor_euler_angle_max,F2); test_int(detect_type,CAD_TYPE_NONE); test_string(ardrone_name,"TEST_CONFIG"); test_string(application_id,"00000000"); test_string(profile_id,"22222222"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, PROFDESC2);//DEFAULT_PROFILE_DESC test_string(session_desc, DEFAULT_SESSION_DESC); set_string(profile_id,"00000000"); mypause(); /*-----------------------------------------------------------------------------------------------*/ /* Create a session configuration file */ title("\nCreating the session ID 33333333 ...\n"); set_string(session_id,"33333333"); title("\nGetting the drone configuration ...\n"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); /* CAT_COMMON param; its value should not be changed by creating a session */ test_int(bitrate_ctrl_mode,1); /* CAT_APPLI param; its value should not be changed by creating a session */ test_float(outdoor_euler_angle_max,F1); /* value in default config.ini */ test_int(detect_type,CAD_TYPE_NONE); /* CAT_SESSION param; its value should be the default one */ test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"33333333"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC ); //DEFAULT_SESSION_DESC); /* Test changing a value in the session */ set_int(detect_type,CAD_TYPE_VISION); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_int(detect_type,CAD_TYPE_VISION); mypause(); title("\nGoing back to the default session configuration ...\n"); set_string(session_id,"00000000"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); /* value in default config.ini */ test_float(outdoor_euler_angle_max,F1); /* value in default config.ini */ test_int(detect_type,CAD_TYPE_NONE); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); mypause(); title(" Going back to the newly created session configuration ...\n"); set_string(session_id,"33333333"); set_string(session_desc,SESSDESC3); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); /* value in default config.ini */ test_float(outdoor_euler_angle_max,F1); /* value in default config.ini */ test_int(detect_type,CAD_TYPE_VISION); test_string(ardrone_name,"TEST_CONFIG"); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"33333333"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, SESSDESC3 ); //DEFAULT_SESSION_DESC); set_int(detect_type,CAD_TYPE_COCARDE); set_string(session_id,"00000000"); mypause(); /*-----------------------------------------------------------------------------------------------*/ /* Create a session configuration file */ title("\nCreating the session ID 44444444 ...\n"); set_string(session_id,"44444444"); title("\nGetting the drone configuration ...\n"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_int(detect_type,CAD_TYPE_NONE); test_string(ardrone_name,"TEST_CONFIG"); test_int(bitrate_ctrl_mode,1); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"44444444"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC ); //FAULT_SESSION_DESC); set_int(detect_type,CAD_TYPE_VISION); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_int(detect_type,CAD_TYPE_VISION); set_string(application_id,"11111111"); set_string(profile_id,"22222222"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG"); set_string(ardrone_name,"TEST_CONFIG2"); test_string(application_id,"11111111"); test_string(profile_id,"22222222"); test_string(session_id,"44444444"); test_string(application_desc , APPDESC1); test_string(profile_desc, PROFDESC2); test_string(session_desc, DEFAULT_SESSION_DESC); mypause(); while(1){ title("\nGoing back to the default session ...\n"); set_string(session_id,"00000000"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG2"); test_int(bitrate_ctrl_mode,1); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); mypause(); title("\nGoing back to the 44444444 session ...\n"); set_string(session_id,"44444444"); set_string(session_desc,SESSDESC4); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG2"); test_int(bitrate_ctrl_mode,0); test_string(application_id,"11111111"); test_string(profile_id,"22222222"); test_string(session_id,"44444444"); test_string(application_desc , APPDESC1); test_string(profile_desc, PROFDESC2); test_string(session_desc, SESSDESC4); mypause(); title("\nGoing back to the default session ...\n"); set_string(session_id,"00000000"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG2"); set_string(ardrone_name,"TEST_CONFIG3"); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); mypause(); title(" Going back to the 33333333 session ...\n"); set_string(session_id,"33333333"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG3"); test_int(bitrate_ctrl_mode,1); /* value in default config.ini */ test_float(outdoor_euler_angle_max,F1); /* value in default config.ini */ test_int(detect_type,CAD_TYPE_COCARDE); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"33333333"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, SESSDESC3); mypause(); title("\nGoing back to the 44444444 session ...\n"); set_string(session_id,"44444444"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG3"); set_string(ardrone_name,"TEST_CONFIG4"); test_int(bitrate_ctrl_mode,0); test_float(outdoor_euler_angle_max,F2); test_int(detect_type,CAD_TYPE_VISION); test_string(application_id,"11111111"); test_string(profile_id,"22222222"); test_string(session_id,"44444444"); test_string(application_desc , APPDESC1); test_string(profile_desc, PROFDESC2); test_string(session_desc, SESSDESC4); mypause(); title(" Going back to the 33333333 session ...\n"); set_string(session_id,"33333333"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_int(bitrate_ctrl_mode,1); test_int(detect_type,CAD_TYPE_COCARDE); test_string(ardrone_name,"TEST_CONFIG4"); test_int(bitrate_ctrl_mode,1); test_float(outdoor_euler_angle_max,F1); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"33333333"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, SESSDESC3); mypause(); title("\nGoing back to the default session ...\n"); set_string(session_id,"00000000"); {ARDRONE_TOOL_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} test_string(ardrone_name,"TEST_CONFIG4"); /* common parameter whose value should never be reset */ test_int(bitrate_ctrl_mode,1); test_float(outdoor_euler_angle_max,F1); test_int(detect_type,CAD_TYPE_NONE); test_string(application_id,"00000000"); test_string(profile_id,"00000000"); test_string(session_id,"00000000"); test_string(application_desc , DEFAULT_APPLICATION_DESC); test_string(profile_desc, DEFAULT_PROFILE_DESC); test_string(session_desc, DEFAULT_SESSION_DESC); set_string(ardrone_name,"TEST_CONFIG2"); mypause(); /*-----------------------------------------------------------------------------------------------*/ /* Read the list of custom configurations */ title("\nReading the list of custom configuration files ...\n"); {ARDRONE_TOOL_CUSTOM_CONFIGURATION_GET(test_callback);vp_os_cond_wait(&test_condition);} printf("\n\n ====================================== \n\n"); if(available_configurations[CAT_APPLI].nb_configurations!=1) { printf("Bad number of custom applis.\n"); } if(available_configurations[CAT_USER].nb_configurations!=1) { printf("Bad number of custom applis.\n"); } if(available_configurations[CAT_SESSION].nb_configurations!=2) { printf("Bad number of custom applis.\n"); } if (available_configurations[CAT_APPLI].list[0].id==NULL) { printf("Unexpected custom app 0 NULL\n"); } else if (strcmp(available_configurations[CAT_APPLI].list[0].id,"11111111")) { printf("Unexpected custom app : <%s>\n",available_configurations[CAT_APPLI].list[0].id); } if (available_configurations[CAT_USER].list[0].id==NULL) { printf("Unexpected custom user 0 NULL\n"); } else if (strcmp(available_configurations[CAT_USER].list[0].id,"22222222")) { printf("Unexpected custom profile : <%s>\n",available_configurations[CAT_USER].list[0].id); } if (available_configurations[CAT_SESSION].list[0].id==NULL) { printf("Unexpected custom session 0 NULL\n"); } else if (strcmp(available_configurations[CAT_SESSION].list[0].id,"33333333")) { printf("Unexpected custom session 0 : <%s>\n",available_configurations[CAT_SESSION].list[0].id); } if (available_configurations[CAT_SESSION].list[1].id==NULL) { printf("Unexpected custom session 1 NULL\n"); } else if (strcmp(available_configurations[CAT_SESSION].list[1].id,"44444444")) { printf("Unexpected custom session 1 : <%s>\n",available_configurations[CAT_SESSION].list[1].id); } if (available_configurations[CAT_APPLI].list[0].description==NULL) { printf("Unexpected custom appli descrition 0 NULL\n"); } else if (strcmp(available_configurations[CAT_APPLI].list[0].description,APPDESC1)) { printf("Unexpected custom app description : <%s>\n",available_configurations[CAT_APPLI].list[0].description); } if (available_configurations[CAT_USER].list[0].description==NULL) { printf("Unexpected custom user 0 description NULL\n"); } else if (strcmp(available_configurations[CAT_USER].list[0].description,PROFDESC2)) { printf("Unexpected custom profile description : <%s>\n",available_configurations[CAT_USER].list[0].description); } if (available_configurations[CAT_SESSION].list[0].description==NULL) { printf("Unexpected custom session 0 description NULL\n"); } else if (strcmp(available_configurations[CAT_SESSION].list[0].description,SESSDESC3)) { printf("Unexpected custom session 0 description : <%s>\n",available_configurations[CAT_SESSION].list[0].description); } if (available_configurations[CAT_SESSION].list[1].description==NULL) { printf("Unexpected custom session 1 description NULL\n"); } else if (strcmp(available_configurations[CAT_SESSION].list[1].description,SESSDESC4)) { printf("Unexpected custom session 1 description : <%s>\n",available_configurations[CAT_SESSION].list[1].description); } printf(" Custom config list checked.\n"); mypause(); /*-----------------------------------------------------------------------------------------------*/ printf("\n\n ====================================== \n\n"); title("\nEnd of the test.\n"); } }