您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ test_assert_true函数代码示例

51自学网 2021-06-03 08:44:56
  C++
这篇教程C++ test_assert_true函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中test_assert_true函数的典型用法代码示例。如果您正苦于以下问题:C++ test_assert_true函数的具体用法?C++ test_assert_true怎么用?C++ test_assert_true使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了test_assert_true函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: run_wdt_early_warning_test

/** * /brief Test Early Warning of Watchdog module * * If last reset cause was not Watchdog, following the Watchdog initialization * and enabling in the previous test, this function will wait for * CONF_WDT_EARLY_WARNING_WAIT_MS and will check if early warning flag is set. * Consequently, clear the early warning flag. * * /param test Current test case. */static void run_wdt_early_warning_test(const struct test_case *test){	/* Check if last reset was by Watchdog module */	if (wdr_flag == false) {		/* Wait for Early Warning flag to be set */		delay_ms(CONF_WDT_EARLY_WARNING_WAIT_MS);		/* Check if the Early Warning flag is set */		test_assert_true(test, wdt_is_early_warning() == true,				"Early Warning failed /n");		/* Clear the Early Warning flag */		wdt_clear_early_warning();	}}
开发者ID:InSoonPark,项目名称:asf,代码行数:25,


示例2: test_copy

void test_copy() {  state_map_type * state_map = state_map_alloc();  state_map_iset( state_map , 0 , STATE_INITIALIZED );  state_map_iset( state_map , 100 , STATE_INITIALIZED );  {    state_map_type * copy = state_map_alloc_copy( state_map );    test_assert_true( state_map_equal( copy , state_map ));    state_map_iset( state_map , 10 , STATE_INITIALIZED );    test_assert_false( state_map_equal( copy , state_map ));                              state_map_free( copy );  }  state_map_free( state_map );}
开发者ID:myrseth,项目名称:ert,代码行数:15,


示例3: test_write_gen_kw_export_file

void test_write_gen_kw_export_file(enkf_main_type * enkf_main){  test_assert_not_NULL(enkf_main);  enkf_state_type * state = enkf_main_iget_state( enkf_main , 0 );  test_assert_not_NULL(state);  enkf_node_type * enkf_node = enkf_state_get_node( state , "MULTFLT" );  test_assert_not_NULL(enkf_node);  const enkf_config_node_type * config_node = enkf_node_get_config(enkf_node);  test_assert_not_NULL(config_node);  if (GEN_KW == enkf_config_node_get_impl_type(config_node)) {    enkf_fs_type * fs = enkf_main_get_fs(enkf_main);    enkf_state_ecl_write(state, fs);    test_assert_true(util_file_exists("parameters.txt"));  }}
开发者ID:patricknraanes,项目名称:ert,代码行数:16,


示例4: test_create_from_summary

void test_create_from_summary(ecl_grid_type * grid) {  container_config_type * container_config = container_config_alloc( "Container");  block_obs_type * block_obs = block_obs_alloc( "ObsKey" , container_config , grid );    test_assert_true( block_obs_is_instance( block_obs ));  test_assert_int_equal(0 , block_obs_get_size( block_obs ));    block_obs_append_summary_obs( block_obs , 10 , 12 , 8  , "BPR:111,13,9" , 100 , 25);  test_assert_int_equal(1 , block_obs_get_size( block_obs ));  block_obs_append_summary_obs( block_obs , 10 , 12 , 9  , "BPR:11,13,10" , 100 , 25);  test_assert_int_equal(2 , block_obs_get_size( block_obs ));  block_obs_free( block_obs );  container_config_free( container_config );}
开发者ID:blattms,项目名称:ert,代码行数:16,


示例5: run_lwmesh_nwk_darareq_test

static void run_lwmesh_nwk_darareq_test(const struct test_case *test){	unitDataReq();	while (1) {		if (result) {			break;		}		if (timeout) {			test_assert_true(test, 0,					"AVR2130_LWMesh - NWK Data request failed");		}		SYS_TaskHandler();	}}
开发者ID:InSoonPark,项目名称:asf,代码行数:16,


示例6: test_install_workflow

void test_install_workflow( const char * config_file , const char * job_file ) {  ert_test_context_type * test_context = ert_test_context_alloc("INSTALL_WORKFLOW" , config_file , NULL );  const char * wf_file = "WFLOW";  ert_test_context_install_workflow_job( test_context , "JOB" , job_file );  {    FILE * stream = util_fopen( wf_file , "w");    stringlist_type * args = stringlist_alloc_new( );    stringlist_append_ref( args , "NewCase");    ert_test_context_fwrite_workflow_job( stream , "JOB" , args);    stringlist_free( args );    fclose( stream );  }  test_assert_true( ert_test_context_install_workflow( test_context , "WFLOW" , wf_file ));  ert_test_context_free( test_context );}
开发者ID:blattms,项目名称:ert,代码行数:16,


示例7: test_run_workflow_job

void test_run_workflow_job( const char * config_file , const char * job_file ) {  ert_test_context_type * test_context = ert_test_context_alloc("CREATE_CONTEXT_JOB" , config_file , NULL );  stringlist_type * args0 = stringlist_alloc_new( );  stringlist_type * args1 = stringlist_alloc_new( );  stringlist_append_ref( args1 , "NewCase");  test_assert_false( ert_test_context_run_worklow_job( test_context , "NO-this-does-not-exist" , args1));  ert_test_context_install_workflow_job( test_context , "JOB" , job_file );    test_assert_false( ert_test_context_run_worklow_job( test_context , "JOB" , args0));  test_assert_true( ert_test_context_run_worklow_job( test_context , "JOB" , args1));    stringlist_free( args0 );  stringlist_free( args1 );  ert_test_context_free( test_context );}
开发者ID:blattms,项目名称:ert,代码行数:16,


示例8: test_case_initialized

void test_case_initialized() {  test_work_area_type * work_area = test_work_area_alloc("enkf_main_case_initialized" );  {    enkf_main_type * enkf_main = enkf_main_alloc_empty();    model_config_type * model_config = enkf_main_get_model_config(enkf_main);    const char * new_case = "fs/case";    char * mount_point = util_alloc_sprintf("%s/%s" , model_config_get_enspath(model_config) , new_case);    enkf_fs_create_fs(mount_point , BLOCK_FS_DRIVER_ID , NULL);    test_assert_false(enkf_main_case_is_initialized(enkf_main , "does/not/exist" , NULL));    test_assert_true(enkf_main_case_is_initialized(enkf_main , new_case , NULL));    enkf_main_free(enkf_main);  }  test_work_area_free(work_area);}
开发者ID:PETECLAM,项目名称:ResInsight,代码行数:16,


示例9: ov7740_test_initialization_run

/** * /brief Test the OV7740 initialization. * * /param test Current test case. */static void ov7740_test_initialization_run(const struct test_case* const test){	volatile uint32_t ul_error = 0;	ul_error = capture_init();	/* if initialization test failed, set g_ul_init_error_flag to avoid	 * other tests to lock up */	if (ul_error == 1) {		g_ul_init_error_flag = true;	}	/* Check Result of the previous test */	test_assert_true(test, ul_error == 0,			"OV7740 initialization test failed!");}
开发者ID:marekr,项目名称:asf,代码行数:21,


示例10: run_sleep_trigger_test

/** * /brief Test interrupt is getting triggered in various Sleep mode. * * This function put the device in Idle and Power Save sleep mode and check * whether the ADC conversion complete interrupt is executed only in Idle sleep * mode. * The device will wakeup from power save mode when Timer/Counter2 overflow * occur. * * /param test Current test case. */static void run_sleep_trigger_test(const struct test_case *test){    /* Disable Global interrupt */    cpu_irq_disable();    /* Initialize the lock counts */    sleepmgr_init();    /* Initialize the ADC */    adc_initialisation();    /* Initialize the Timer/Counter2 */    timer2_initialisation();    /* Lock Idle Sleep mode */    sleepmgr_lock_mode(SLEEPMGR_IDLE);    /* Clear Timer/Counter2 Register */    TCNT2 = 0;    /* Wait for TCNT2 register to get updated */    while (ASSR & (1 << TCN2UB)) {    }    /* Start ADC Conversion */    adc_start_conversion();    /* Enable Global interrupt */    cpu_irq_enable();    /* Go to sleep in the deepest allowed mode */    sleepmgr_enter_sleep();    /* Unlock Idle Sleep mode */    sleepmgr_unlock_mode(SLEEPMGR_IDLE);    /* Lock Power Save mode */    sleepmgr_lock_mode(SLEEPMGR_PSAVE);    /* Clear Timer/Counter2 Register */    TCNT2 = 0;    /* Wait for TCNT2 register to get updated */    while (ASSR & (1 << TCN2UB)) {    }    /* Start ADC Conversion */    adc_start_conversion();    /* Go to sleep in the deepest allowed mode */    sleepmgr_enter_sleep();    /* Disable ADC */    adc_disable();    /* Unlock Power Save mode */    sleepmgr_unlock_mode(SLEEPMGR_PSAVE);    /* Disable Global interrupt */    cpu_irq_disable();    test_assert_true(test, trigger_count == 2,                     "ADC interrupt trigger failed.");}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:58,


示例11: run_test_get_gravity_value

/** * /brief Get the gravity value of z axis. * * This test calls the get gravity value API functions and check if the value is in correct range. * * /param test Current test case. */static void run_test_get_gravity_value(const struct test_case *test){	xyz_g_t xyz_g;	/* Set MMA7341L normal mode */	mma7341l_set_mode(MMA7341L_NORMAL_MODE);	/* Initialize MMA7341L */	mma7341l_init();	/* Calibrate MMA7341L */	mma7341l_calibration();	xyz_g = mma7341l_get_gravity_value();	test_assert_true(test, 0.9 < xyz_g.z_g < 1.1, "The gravity value is not in correct range");}
开发者ID:InSoonPark,项目名称:asf,代码行数:24,


示例12: run_event_back_spincollection_test

/** * /internal * /brief Test spinning through a spincollection and cancelling * * This test checks that spinning in a spincollection with two spinners * and pressing the back button results in the correct event. * * /param test Current test case. */static void run_event_back_spincollection_test(const struct test_case *test){	int16_t actual[2];	uint8_t actual_status_code;	uint8_t expected_status_code;	struct gfx_mono_spinctrl spinner;	struct gfx_mono_spinctrl spinner2;	struct gfx_mono_spinctrl_spincollection spincollection;	expected_status_code = GFX_MONO_SPINCTRL_EVENT_BACK;	// Initialize spinners and spincollection and add spinners to collection	gfx_mono_spinctrl_init(&spinner, SPINTYPE_INTEGER, spinnertitle2, NULL,			40, 48, 0);	gfx_mono_spinctrl_init(&spinner2, SPINTYPE_INTEGER, spinnertitle3, NULL,			55, 110, 0);	gfx_mono_spinctrl_spincollection_init(&spincollection);	gfx_mono_spinctrl_spincollection_add_spinner(&spinner, &spincollection);	gfx_mono_spinctrl_spincollection_add_spinner(&spinner2, &spincollection);	// Go down to next spinner	gfx_mono_spinctrl_spincollection_process_key(&spincollection,			GFX_MONO_SPINCTRL_KEYCODE_DOWN, actual);	// Select current spinner	gfx_mono_spinctrl_spincollection_process_key(&spincollection,			GFX_MONO_SPINCTRL_KEYCODE_ENTER, actual);	// Spin spinner	gfx_mono_spinctrl_spincollection_process_key(&spincollection,			GFX_MONO_SPINCTRL_KEYCODE_DOWN, actual);	// Spin spinner	gfx_mono_spinctrl_spincollection_process_key(&spincollection,			GFX_MONO_SPINCTRL_KEYCODE_DOWN, actual);	// Spin spinner	gfx_mono_spinctrl_spincollection_process_key(&spincollection,			GFX_MONO_SPINCTRL_KEYCODE_DOWN, actual);	// Deselect spinner	gfx_mono_spinctrl_spincollection_process_key(&spincollection,			GFX_MONO_SPINCTRL_KEYCODE_BACK, actual);	// Cancel spincollection	actual_status_code = gfx_mono_spinctrl_spincollection_process_key(			&spincollection, GFX_MONO_SPINCTRL_KEYCODE_BACK, actual);	test_assert_true(test, actual_status_code == expected_status_code,			"Status code mismatch: %d != %d", actual_status_code,			expected_status_code);}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:55,


示例13: create_test_area

void create_test_area(const char * test_name , bool store) {  char * pre_cwd = util_alloc_cwd();  test_work_area_type * work_area = test_work_area_alloc( test_name , store);  char * work_path = util_alloc_string_copy( test_work_area_get_cwd( work_area ));    test_assert_true( util_is_directory( work_path ));  test_work_area_free( work_area );  test_assert_bool_equal( store , util_entry_exists( work_path ));    {    char * post_cwd = util_alloc_cwd();    test_assert_string_equal( pre_cwd , post_cwd );    free( post_cwd );  }  free( pre_cwd );  free( work_path );}
开发者ID:JacobStoren,项目名称:ert,代码行数:17,


示例14: ov7740_test_color_run

/** * /brief Test color of the reference picture from OV7740 image sensor. * * /param test Current test case. */static void ov7740_test_color_run(const struct test_case* const test){	uint32_t ul_error = 0;	volatile uint32_t ul_index = 25600UL; /* put the index at the middle of																					* data buffer */	/* Check if picture color is similar to reference color. There are 8	 * reference colors	 * (Black, Blue, Red, Purple, Green, Cyan, Yellow, White) and each of	 * these contains 80 pixel.	 * So put the index to the middle of the testing color area of picture	 * and test this color.	 */	/* Test black color */	ul_error += test_color((uint8_t *)g_auc_data_black_color,			g_auc_capture_buffer, ul_index + 40 );	/* Test blue color */	ul_error += test_color((uint8_t *)g_auc_data_blue_color, g_auc_capture_buffer,			ul_index + 120);	/* Test red color */	ul_error += test_color((uint8_t *)g_auc_data_red_color, g_auc_capture_buffer,			ul_index + 200);	/* Test purple color */	ul_error += test_color((uint8_t *)g_auc_data_purple_color,			g_auc_capture_buffer, ul_index + 280);	/* Test green color */	ul_error += test_color((uint8_t *)g_auc_data_green_color,			g_auc_capture_buffer, ul_index + 360);	/* Test cyan color */	ul_error += test_color((uint8_t *)g_auc_data_cyan_color, g_auc_capture_buffer,			ul_index + 440);	/* Test yellow color */	ul_error += test_color((uint8_t *)g_auc_data_yellow_color,			g_auc_capture_buffer, ul_index + 520 );	/* Test white color */	ul_error += test_color((uint8_t *)g_auc_data_white_color,			g_auc_capture_buffer, ul_index + 600);	/* Check Result of previous test */	test_assert_true(test, ul_error == 0, "OV7740 color test failed!");}
开发者ID:marekr,项目名称:asf,代码行数:51,


示例15: test_loadall

void test_loadall(const char * src_file , const char * target_file ) {  util_copy_file( src_file , target_file );  {    ecl_file_type * ecl_file = ecl_file_open( target_file , ECL_FILE_CLOSE_STREAM );    test_assert_true( ecl_file_load_all( ecl_file ) );    ecl_file_close( ecl_file );  }  {    ecl_file_type * ecl_file = ecl_file_open( target_file , ECL_FILE_CLOSE_STREAM );    unlink( target_file );    test_assert_false( ecl_file_load_all( ecl_file ) );    ecl_file_close( ecl_file );  }}
开发者ID:Ensembles,项目名称:ert,代码行数:17,


示例16: run_backup_test

/** * /brief Test entering and exiting backup mode. * * /param test Current test case. */static void run_backup_test(const struct test_case *test){	volatile uint32_t wakeup_cause = bpm_get_backup_wakeup_cause(BPM);	/* Wakeup from backup mode */	if (wakeup_cause) {		test_assert_true(test, wakeup_cause & (1 << BPM_BKUPWEN_AST),			"Unexpected backup wakeup cause, should be AST!");		return;	}	/* Wait for the printf operation to finish before	setting the device in a power save mode. */	delay_ms(30);	/* Enter backup mode */	bpm_sleep(BPM, BPM_SM_BACKUP);}
开发者ID:InSoonPark,项目名称:asf,代码行数:22,


示例17: run_adc_window_mode_test

/** * /internal * /brief ADC window mode test function * * This test gives an input voltage outside the window and checks * whether the callback is triggered or not. * * /param test Current test case. */static void run_adc_window_mode_test(const struct test_case *test){	uint16_t timeout_cycles = 0xFFFF;	/* Set 1V DAC output */	dac_chan_write(&dac_inst, DAC_CHANNEL_0, DAC_VAL_ONE_VOLT);	delay_ms(1);	do {		timeout_cycles--;		if (interrupt_flag) {			break;		}	} while (timeout_cycles > 0);	test_assert_true(test, timeout_cycles > 0,			"Timeout in window detection");}
开发者ID:InSoonPark,项目名称:asf,代码行数:26,


示例18: run_test_at25dfx_init

/** * /brief Test AT25DFx initialization procedure. * * This test calls the initialization function and checks the SerialFlash. * * /param test Current test case. */static void run_test_at25dfx_init(const struct test_case *test){    at25_status_t status;    /* Initialize the SerialFlash */    at25dfx_initialize();    /* Set the SerialFlash active */    at25dfx_set_mem_active(AT25DFX_MEM_ID);    /* Check if the SerialFlash is valid */    status = at25dfx_mem_check();    /* Validate the SerialFlash init and check function */    test_assert_true(test, status == AT25_SUCCESS,                     "Specific SerialFlash not found!");}
开发者ID:Tjalling7,项目名称:asf,代码行数:24,


示例19: test_util_addr2line

void test_util_addr2line() {  const char * file = __FILE__;  const char * func = __func__;  int    line;  const int max_bt = 50;  void *bt_addr[max_bt];    int size;  char * func_name , * file_name;  int line_nr;    line = __LINE__ + 2;  size = backtrace(bt_addr , max_bt);      test_assert_int_equal( size , 4 );  test_assert_true( util_addr2line_lookup( bt_addr[0] , &func_name , &file_name , &line_nr));  test_assert_string_equal( func_name , func );  test_assert_int_equal( line , line_nr );  test_assert_string_equal( file_name , file );}
开发者ID:blattms,项目名称:ert,代码行数:18,


示例20: test_column_equal

void test_column_equal() {  matrix_type * m1 = matrix_alloc(5,5);  matrix_type * m2 = matrix_alloc(5,5);  matrix_type * m3 = matrix_alloc(6,5);  rng_type * rng = rng_alloc( MZRAN , INIT_DEFAULT );   matrix_random_init( m1 , rng );  matrix_assign( m2 , m1 );  test_assert_true( matrix_columns_equal( m1 , 2 , m2 , 2 ));  test_assert_false( matrix_columns_equal( m1 , 2 , m2 , 3 ));  test_assert_false( matrix_columns_equal( m1 , 2 , m3 , 3 ));    rng_free( rng );  matrix_free( m1 );  matrix_free( m2 );  matrix_free( m3 );}
开发者ID:danielfmva,项目名称:ert,代码行数:18,


示例21: setup_adc_callback_mode_test

/** * /internal * /brief Setup Function: ADC callback mode test. * * This function initializes the ADC result buffer and * registers & enables callback for the ADC buffer read. * * /param test Current test case. */static void setup_adc_callback_mode_test(const struct test_case *test){	interrupt_flag = false;	/* Skip test if ADC initialization failed */	test_assert_true(test, adc_init_success,			"Skipping test due to failed initialization");	/* Initialize ADC buffer */	for (uint8_t i = 0; i < ADC_SAMPLES; i++) {		adc_buf[i] = 0;	}	/* Register and enable buffer read callback */	adc_register_callback(&adc_inst, adc_user_callback,			ADC_CALLBACK_READ_BUFFER);	adc_enable_callback(&adc_inst, ADC_CALLBACK_READ_BUFFER);}
开发者ID:InSoonPark,项目名称:asf,代码行数:27,


示例22: main

int main(int argc , char ** argv) {  const char * config_file = argv[1];  config_parser_type * config = config_alloc();  config_content_type * content;  ensemble_config_type * ensemble = ensemble_config_alloc();  enkf_config_node_add_GEN_PARAM_config_schema( config );  content = config_parse( config , config_file , "--" , NULL , NULL , CONFIG_UNRECOGNIZED_WARN , true );  test_assert_true( config_content_is_valid( content ) );  ensemble_config_init_GEN_PARAM( ensemble, content );  config_content_free( content );  config_free( config );  ensemble_config_free( ensemble );  exit(0);}
开发者ID:YingfangZhou,项目名称:ert,代码行数:18,


示例23: main

int main(int argc , char ** argv) {  int lgr_nr = 77;  nnc_info_type * nnc_info = nnc_info_alloc(lgr_nr);     test_assert_int_equal( 0 , nnc_info_get_total_size( nnc_info ));  test_assert_int_equal( lgr_nr , nnc_info_get_lgr_nr(  nnc_info ));  test_assert_true(nnc_info_is_instance(nnc_info));  test_assert_not_NULL(nnc_info);     nnc_info_add_nnc(nnc_info, lgr_nr, 110 , 0);  test_assert_int_equal( 1, nnc_info_get_total_size( nnc_info ));    nnc_info_add_nnc(nnc_info, 1, 110 , 1);  nnc_info_add_nnc(nnc_info, 1, 111 , 2);  test_assert_int_equal( 3, nnc_info_get_total_size( nnc_info ));    nnc_vector_type * nnc_vector = nnc_info_get_vector( nnc_info , 1);  const int_vector_type * nnc_cells = nnc_info_get_grid_index_list(nnc_info, 1);   test_assert_int_equal(int_vector_size(nnc_cells), 2);   test_assert_ptr_equal( nnc_cells , nnc_vector_get_grid_index_list( nnc_vector ));  nnc_vector_type * nnc_vector_null  = nnc_info_get_vector( nnc_info , 2);  const int_vector_type * nnc_cells_null = nnc_info_get_grid_index_list(nnc_info, 2);   test_assert_NULL(nnc_cells_null);   test_assert_NULL(nnc_vector_null);     nnc_vector_type * nnc_vector_self  = nnc_info_get_self_vector( nnc_info );  const nnc_vector_type * nnc_vector_77  = nnc_info_get_vector( nnc_info , lgr_nr );  test_assert_ptr_equal( nnc_vector_77 , nnc_vector_self );  const int_vector_type * nnc_cells_77 = nnc_info_get_grid_index_list(nnc_info, lgr_nr);   const int_vector_type * nnc_cells_self = nnc_info_get_self_grid_index_list(nnc_info);   test_assert_ptr_equal( nnc_cells_77 , nnc_cells_self );  test_assert_int_equal( 2 , nnc_info_get_size( nnc_info ));  test_assert_ptr_equal( nnc_info_get_vector( nnc_info , 1 ) , nnc_info_iget_vector( nnc_info , 1 ));  nnc_info_free(nnc_info);    exit(0);}
开发者ID:andlaus,项目名称:ResInsight,代码行数:44,



注:本文中的test_assert_true函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ test_begin函数代码示例
C++ test_assert_int_equal函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。