//+ // C++ classes definitions for Tao / C++ structure interface. // // This file is generated as part of the Tao/C++ interface code generation. // The code generation files can be found in cpp_tao_interface. // // DO NOT EDIT THIS FILE DIRECTLY! //- #include #include #include "cpp_tao_classes.h" using namespace std; void set_CPP_ele_test_pattern (CPP_ele& C, int ix_patt); void set_CPP_coord_test_pattern (CPP_coord& C, int ix_patt); void set_CPP_lat_test_pattern (CPP_lat& C, int ix_patt); void set_CPP_beam_test_pattern (CPP_beam& C, int ix_patt); void set_CPP_aperture_scan_test_pattern (CPP_aperture_scan& C, int ix_patt); void set_CPP_rad_int_all_ele_test_pattern (CPP_rad_int_all_ele& C, int ix_patt); void set_CPP_beam_init_test_pattern (CPP_beam_init& C, int ix_patt); void set_CPP_bunch_params_test_pattern (CPP_bunch_params& C, int ix_patt); void set_CPP_normal_modes_test_pattern (CPP_normal_modes& C, int ix_patt); //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_qp_rect (CPP_qp_rect&, bool&); void set_CPP_qp_rect_test_pattern (CPP_qp_rect& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.x1 = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.x2 = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.y1 = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.y2 = rhs; // c_side.test_pat[character, 0, NOT] C.units.resize(16); for (unsigned int i = 0; i < C.units.size(); i++) {int rhs = 101 + i + 5 + offset; C.units[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_qp_rect (Opaque_qp_rect_class* F, bool& c_ok) { CPP_qp_rect C, C2; c_ok = true; qp_rect_to_c (F, C); set_CPP_qp_rect_test_pattern (C2, 1); if (C == C2) { cout << " qp_rect: C side convert F->C: Good" << endl; } else { cout << " qp_rect: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_rect_test_pattern (C2, 2); bool c_ok2; test2_f_qp_rect (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_qp_rect_test_pattern (C, 3); if (C == C2) { cout << " qp_rect: F side convert F->C: Good" << endl; } else { cout << " qp_rect: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_rect_test_pattern (C2, 4); qp_rect_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_qp_line (CPP_qp_line&, bool&); void set_CPP_qp_line_test_pattern (CPP_qp_line& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[integer, 0, NOT] rhs = 1 + offset; C.width = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 2 + offset; C.color = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 3 + offset; C.pattern = rhs; } //-------------------------------------------------------------- extern "C" void test_c_qp_line (Opaque_qp_line_class* F, bool& c_ok) { CPP_qp_line C, C2; c_ok = true; qp_line_to_c (F, C); set_CPP_qp_line_test_pattern (C2, 1); if (C == C2) { cout << " qp_line: C side convert F->C: Good" << endl; } else { cout << " qp_line: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_line_test_pattern (C2, 2); bool c_ok2; test2_f_qp_line (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_qp_line_test_pattern (C, 3); if (C == C2) { cout << " qp_line: F side convert F->C: Good" << endl; } else { cout << " qp_line: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_line_test_pattern (C2, 4); qp_line_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_qp_symbol (CPP_qp_symbol&, bool&); void set_CPP_qp_symbol_test_pattern (CPP_qp_symbol& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[integer, 0, NOT] rhs = 1 + offset; C.type = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.height = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 3 + offset; C.color = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 4 + offset; C.fill_pattern = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 5 + offset; C.line_width = rhs; } //-------------------------------------------------------------- extern "C" void test_c_qp_symbol (Opaque_qp_symbol_class* F, bool& c_ok) { CPP_qp_symbol C, C2; c_ok = true; qp_symbol_to_c (F, C); set_CPP_qp_symbol_test_pattern (C2, 1); if (C == C2) { cout << " qp_symbol: C side convert F->C: Good" << endl; } else { cout << " qp_symbol: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_symbol_test_pattern (C2, 2); bool c_ok2; test2_f_qp_symbol (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_qp_symbol_test_pattern (C, 3); if (C == C2) { cout << " qp_symbol: F side convert F->C: Good" << endl; } else { cout << " qp_symbol: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_symbol_test_pattern (C2, 4); qp_symbol_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_qp_point (CPP_qp_point&, bool&); void set_CPP_qp_point_test_pattern (CPP_qp_point& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.x = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.y = rhs; // c_side.test_pat[character, 0, NOT] C.units.resize(16); for (unsigned int i = 0; i < C.units.size(); i++) {int rhs = 101 + i + 3 + offset; C.units[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_qp_point (Opaque_qp_point_class* F, bool& c_ok) { CPP_qp_point C, C2; c_ok = true; qp_point_to_c (F, C); set_CPP_qp_point_test_pattern (C2, 1); if (C == C2) { cout << " qp_point: C side convert F->C: Good" << endl; } else { cout << " qp_point: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_point_test_pattern (C2, 2); bool c_ok2; test2_f_qp_point (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_qp_point_test_pattern (C, 3); if (C == C2) { cout << " qp_point: F side convert F->C: Good" << endl; } else { cout << " qp_point: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_point_test_pattern (C2, 4); qp_point_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_qp_axis (CPP_qp_axis&, bool&); void set_CPP_qp_axis_test_pattern (CPP_qp_axis& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.label.resize(80); for (unsigned int i = 0; i < C.label.size(); i++) {int rhs = 101 + i + 1 + offset; C.label[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.min = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.max = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.number_offset = rhs; // c_side.test_pat[real, 0, NOT] rhs = 5 + offset; C.label_offset = rhs; // c_side.test_pat[real, 0, NOT] rhs = 6 + offset; C.major_tick_len = rhs; // c_side.test_pat[real, 0, NOT] rhs = 7 + offset; C.minor_tick_len = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 8 + offset; C.label_color = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 9 + offset; C.major_div = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 10 + offset; C.major_div_nominal = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 11 + offset; C.minor_div = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 12 + offset; C.minor_div_max = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 13 + offset; C.places = rhs; // c_side.test_pat[character, 0, NOT] C.type.resize(16); for (unsigned int i = 0; i < C.type.size(); i++) {int rhs = 101 + i + 14 + offset; C.type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.bounds.resize(16); for (unsigned int i = 0; i < C.bounds.size(); i++) {int rhs = 101 + i + 15 + offset; C.bounds[i] = 'a' + rhs % 26;} // c_side.test_pat[integer, 0, NOT] rhs = 16 + offset; C.tick_side = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 17 + offset; C.number_side = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 18 + offset; C.draw_label = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 19 + offset; C.draw_numbers = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_qp_axis (Opaque_qp_axis_class* F, bool& c_ok) { CPP_qp_axis C, C2; c_ok = true; qp_axis_to_c (F, C); set_CPP_qp_axis_test_pattern (C2, 1); if (C == C2) { cout << " qp_axis: C side convert F->C: Good" << endl; } else { cout << " qp_axis: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_axis_test_pattern (C2, 2); bool c_ok2; test2_f_qp_axis (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_qp_axis_test_pattern (C, 3); if (C == C2) { cout << " qp_axis: F side convert F->C: Good" << endl; } else { cout << " qp_axis: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_qp_axis_test_pattern (C2, 4); qp_axis_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_cmd_history (CPP_tao_cmd_history&, bool&); void set_CPP_tao_cmd_history_test_pattern (CPP_tao_cmd_history& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, ALLOC] if (ix_patt < 3) C.cmd == NULL; else { C.cmd = new string(:, ' '); for (unsigned int i = 0; i < C.cmd->size(); i++) { (*C.cmd)[i] = 'a' + (101 + i + 1 + offset) % 26; } } // c_side.test_pat[integer, 0, NOT] rhs = 3 + offset; C.ix = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 4 + offset; C.cmd_file = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_cmd_history (Opaque_tao_cmd_history_class* F, bool& c_ok) { CPP_tao_cmd_history C, C2; c_ok = true; tao_cmd_history_to_c (F, C); set_CPP_tao_cmd_history_test_pattern (C2, 1); if (C == C2) { cout << " tao_cmd_history: C side convert F->C: Good" << endl; } else { cout << " tao_cmd_history: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_cmd_history_test_pattern (C2, 2); bool c_ok2; test2_f_tao_cmd_history (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_cmd_history_test_pattern (C, 3); if (C == C2) { cout << " tao_cmd_history: F side convert F->C: Good" << endl; } else { cout << " tao_cmd_history: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_cmd_history_test_pattern (C2, 4); tao_cmd_history_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_real_pointer (CPP_tao_real_pointer&, bool&); void set_CPP_tao_real_pointer_test_pattern (CPP_tao_real_pointer& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[logical, 0, PTR] if (ix_patt < 3) C.good_value = NULL; else { C.good_value = new Bool; rhs = 3 + offset; (*C.good_value) = (rhs % 2 == 0); } // c_side.test_pat[logical, 0, PTR] if (ix_patt < 3) C.good_user = NULL; else { C.good_user = new Bool; rhs = 5 + offset; (*C.good_user) = (rhs % 2 == 0); } } //-------------------------------------------------------------- extern "C" void test_c_tao_real_pointer (Opaque_tao_real_pointer_class* F, bool& c_ok) { CPP_tao_real_pointer C, C2; c_ok = true; tao_real_pointer_to_c (F, C); set_CPP_tao_real_pointer_test_pattern (C2, 1); if (C == C2) { cout << " tao_real_pointer: C side convert F->C: Good" << endl; } else { cout << " tao_real_pointer: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_real_pointer_test_pattern (C2, 2); bool c_ok2; test2_f_tao_real_pointer (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_real_pointer_test_pattern (C, 3); if (C == C2) { cout << " tao_real_pointer: F side convert F->C: Good" << endl; } else { cout << " tao_real_pointer: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_real_pointer_test_pattern (C2, 4); tao_real_pointer_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_logical_array (CPP_tao_logical_array&, bool&); void set_CPP_tao_logical_array_test_pattern (CPP_tao_logical_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_logical_array (Opaque_tao_logical_array_class* F, bool& c_ok) { CPP_tao_logical_array C, C2; c_ok = true; tao_logical_array_to_c (F, C); set_CPP_tao_logical_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_logical_array: C side convert F->C: Good" << endl; } else { cout << " tao_logical_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_logical_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_logical_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_logical_array_test_pattern (C, 3); if (C == C2) { cout << " tao_logical_array: F side convert F->C: Good" << endl; } else { cout << " tao_logical_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_logical_array_test_pattern (C2, 4); tao_logical_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_integer_array (CPP_tao_integer_array&, bool&); void set_CPP_tao_integer_array_test_pattern (CPP_tao_integer_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_integer_array (Opaque_tao_integer_array_class* F, bool& c_ok) { CPP_tao_integer_array C, C2; c_ok = true; tao_integer_array_to_c (F, C); set_CPP_tao_integer_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_integer_array: C side convert F->C: Good" << endl; } else { cout << " tao_integer_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_integer_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_integer_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_integer_array_test_pattern (C, 3); if (C == C2) { cout << " tao_integer_array: F side convert F->C: Good" << endl; } else { cout << " tao_integer_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_integer_array_test_pattern (C2, 4); tao_integer_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_expression_info (CPP_tao_expression_info&, bool&); void set_CPP_tao_expression_info_test_pattern (CPP_tao_expression_info& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[logical, 0, NOT] rhs = 1 + offset; C.good = (rhs % 2 == 0); // c_side.test_pat[integer, 0, NOT] rhs = 2 + offset; C.ix_ele = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.s = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_expression_info (Opaque_tao_expression_info_class* F, bool& c_ok) { CPP_tao_expression_info C, C2; c_ok = true; tao_expression_info_to_c (F, C); set_CPP_tao_expression_info_test_pattern (C2, 1); if (C == C2) { cout << " tao_expression_info: C side convert F->C: Good" << endl; } else { cout << " tao_expression_info: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_expression_info_test_pattern (C2, 2); bool c_ok2; test2_f_tao_expression_info (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_expression_info_test_pattern (C, 3); if (C == C2) { cout << " tao_expression_info: F side convert F->C: Good" << endl; } else { cout << " tao_expression_info: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_expression_info_test_pattern (C2, 4); tao_expression_info_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_eval_stack1 (CPP_tao_eval_stack1&, bool&); void set_CPP_tao_eval_stack1_test_pattern (CPP_tao_eval_stack1& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[integer, 0, NOT] rhs = 1 + offset; C.type = rhs; // c_side.test_pat[character, 0, NOT] C.name.resize(60); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 2 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.scale = rhs; // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.value.resize(0); else { C.value.resize(3); for (unsigned int i = 0; i < C.value.size(); i++) {int rhs = 101 + i + 4 + offset; C.value[i] = rhs;} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.info.resize(0); else { C.info.resize(3); for (unsigned int i = 0; i < C.info.size(); i++) {set_CPP_tao_expression_info_test_pattern(C.info[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.value_ptr.resize(0); else { C.value_ptr.resize(3); for (unsigned int i = 0; i < C.value_ptr.size(); i++) {set_CPP_tao_real_pointer_test_pattern(C.value_ptr[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_eval_stack1 (Opaque_tao_eval_stack1_class* F, bool& c_ok) { CPP_tao_eval_stack1 C, C2; c_ok = true; tao_eval_stack1_to_c (F, C); set_CPP_tao_eval_stack1_test_pattern (C2, 1); if (C == C2) { cout << " tao_eval_stack1: C side convert F->C: Good" << endl; } else { cout << " tao_eval_stack1: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_eval_stack1_test_pattern (C2, 2); bool c_ok2; test2_f_tao_eval_stack1 (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_eval_stack1_test_pattern (C, 3); if (C == C2) { cout << " tao_eval_stack1: F side convert F->C: Good" << endl; } else { cout << " tao_eval_stack1: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_eval_stack1_test_pattern (C2, 4); tao_eval_stack1_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_ele_shape (CPP_tao_ele_shape&, bool&); void set_CPP_tao_ele_shape_test_pattern (CPP_tao_ele_shape& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.ele_id.resize(60); for (unsigned int i = 0; i < C.ele_id.size(); i++) {int rhs = 101 + i + 1 + offset; C.ele_id[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.shape.resize(40); for (unsigned int i = 0; i < C.shape.size(); i++) {int rhs = 101 + i + 2 + offset; C.shape[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.color.resize(16); for (unsigned int i = 0; i < C.color.size(); i++) {int rhs = 101 + i + 3 + offset; C.color[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.size = rhs; // c_side.test_pat[character, 0, NOT] C.label.resize(16); for (unsigned int i = 0; i < C.label.size(); i++) {int rhs = 101 + i + 5 + offset; C.label[i] = 'a' + rhs % 26;} // c_side.test_pat[logical, 0, NOT] rhs = 6 + offset; C.draw = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 7 + offset; C.multi = (rhs % 2 == 0); // c_side.test_pat[integer, 0, NOT] rhs = 8 + offset; C.ix_ele_key = rhs; // c_side.test_pat[character, 0, NOT] C.name_ele.resize(40); for (unsigned int i = 0; i < C.name_ele.size(); i++) {int rhs = 101 + i + 9 + offset; C.name_ele[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_tao_ele_shape (Opaque_tao_ele_shape_class* F, bool& c_ok) { CPP_tao_ele_shape C, C2; c_ok = true; tao_ele_shape_to_c (F, C); set_CPP_tao_ele_shape_test_pattern (C2, 1); if (C == C2) { cout << " tao_ele_shape: C side convert F->C: Good" << endl; } else { cout << " tao_ele_shape: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_ele_shape_test_pattern (C2, 2); bool c_ok2; test2_f_tao_ele_shape (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_ele_shape_test_pattern (C, 3); if (C == C2) { cout << " tao_ele_shape: F side convert F->C: Good" << endl; } else { cout << " tao_ele_shape: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_ele_shape_test_pattern (C2, 4); tao_ele_shape_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_pattern_point (CPP_tao_pattern_point&, bool&); void set_CPP_tao_pattern_point_test_pattern (CPP_tao_pattern_point& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.s = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.x = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.radius = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_pattern_point (Opaque_tao_pattern_point_class* F, bool& c_ok) { CPP_tao_pattern_point C, C2; c_ok = true; tao_pattern_point_to_c (F, C); set_CPP_tao_pattern_point_test_pattern (C2, 1); if (C == C2) { cout << " tao_pattern_point: C side convert F->C: Good" << endl; } else { cout << " tao_pattern_point: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_pattern_point_test_pattern (C2, 2); bool c_ok2; test2_f_tao_pattern_point (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_pattern_point_test_pattern (C, 3); if (C == C2) { cout << " tao_pattern_point: F side convert F->C: Good" << endl; } else { cout << " tao_pattern_point: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_pattern_point_test_pattern (C2, 4); tao_pattern_point_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_pattern_curve (CPP_tao_pattern_curve&, bool&); void set_CPP_tao_pattern_curve_test_pattern (CPP_tao_pattern_curve& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 0, NOT] set_CPP_qp_line_test_pattern(C.line, ix_patt); // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.pt.resize(0); else { C.pt.resize(3); for (unsigned int i = 0; i < C.pt.size(); i++) {set_CPP_tao_pattern_point_test_pattern(C.pt[i], ix_patt+i+1);} } // c_side.test_pat[character, 0, NOT] C.scale.resize(8); for (unsigned int i = 0; i < C.scale.size(); i++) {int rhs = 101 + i + 4 + offset; C.scale[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_tao_pattern_curve (Opaque_tao_pattern_curve_class* F, bool& c_ok) { CPP_tao_pattern_curve C, C2; c_ok = true; tao_pattern_curve_to_c (F, C); set_CPP_tao_pattern_curve_test_pattern (C2, 1); if (C == C2) { cout << " tao_pattern_curve: C side convert F->C: Good" << endl; } else { cout << " tao_pattern_curve: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_pattern_curve_test_pattern (C2, 2); bool c_ok2; test2_f_tao_pattern_curve (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_pattern_curve_test_pattern (C, 3); if (C == C2) { cout << " tao_pattern_curve: F side convert F->C: Good" << endl; } else { cout << " tao_pattern_curve: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_pattern_curve_test_pattern (C2, 4); tao_pattern_curve_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_shape_pattern (CPP_tao_shape_pattern&, bool&); void set_CPP_tao_shape_pattern_test_pattern (CPP_tao_shape_pattern& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.curve.resize(0); else { C.curve.resize(3); for (unsigned int i = 0; i < C.curve.size(); i++) {set_CPP_tao_pattern_curve_test_pattern(C.curve[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_shape_pattern (Opaque_tao_shape_pattern_class* F, bool& c_ok) { CPP_tao_shape_pattern C, C2; c_ok = true; tao_shape_pattern_to_c (F, C); set_CPP_tao_shape_pattern_test_pattern (C2, 1); if (C == C2) { cout << " tao_shape_pattern: C side convert F->C: Good" << endl; } else { cout << " tao_shape_pattern: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_shape_pattern_test_pattern (C2, 2); bool c_ok2; test2_f_tao_shape_pattern (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_shape_pattern_test_pattern (C, 3); if (C == C2) { cout << " tao_shape_pattern: F side convert F->C: Good" << endl; } else { cout << " tao_shape_pattern: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_shape_pattern_test_pattern (C2, 4); tao_shape_pattern_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_drawing (CPP_tao_drawing&, bool&); void set_CPP_tao_drawing_test_pattern (CPP_tao_drawing& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.ele_shape.resize(0); else { C.ele_shape.resize(3); for (unsigned int i = 0; i < C.ele_shape.size(); i++) {set_CPP_tao_ele_shape_test_pattern(C.ele_shape[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_drawing (Opaque_tao_drawing_class* F, bool& c_ok) { CPP_tao_drawing C, C2; c_ok = true; tao_drawing_to_c (F, C); set_CPP_tao_drawing_test_pattern (C2, 1); if (C == C2) { cout << " tao_drawing: C side convert F->C: Good" << endl; } else { cout << " tao_drawing: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_drawing_test_pattern (C2, 2); bool c_ok2; test2_f_tao_drawing (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_drawing_test_pattern (C, 3); if (C == C2) { cout << " tao_drawing: F side convert F->C: Good" << endl; } else { cout << " tao_drawing: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_drawing_test_pattern (C2, 4); tao_drawing_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_wave_kick_pt (CPP_tao_wave_kick_pt&, bool&); void set_CPP_tao_wave_kick_pt_test_pattern (CPP_tao_wave_kick_pt& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.phi_s = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.phi_r = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.phi = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.amp = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 5 + offset; C.ix_dat = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_wave_kick_pt (Opaque_tao_wave_kick_pt_class* F, bool& c_ok) { CPP_tao_wave_kick_pt C, C2; c_ok = true; tao_wave_kick_pt_to_c (F, C); set_CPP_tao_wave_kick_pt_test_pattern (C2, 1); if (C == C2) { cout << " tao_wave_kick_pt: C side convert F->C: Good" << endl; } else { cout << " tao_wave_kick_pt: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_wave_kick_pt_test_pattern (C2, 2); bool c_ok2; test2_f_tao_wave_kick_pt (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_wave_kick_pt_test_pattern (C, 3); if (C == C2) { cout << " tao_wave_kick_pt: F side convert F->C: Good" << endl; } else { cout << " tao_wave_kick_pt: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_wave_kick_pt_test_pattern (C2, 4); tao_wave_kick_pt_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_wave (CPP_tao_wave&, bool&); void set_CPP_tao_wave_test_pattern (CPP_tao_wave& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.data_type.resize(40); for (unsigned int i = 0; i < C.data_type.size(); i++) {int rhs = 101 + i + 1 + offset; C.data_type[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.rms_rel_a = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.rms_rel_b = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.rms_rel_as = rhs; // c_side.test_pat[real, 0, NOT] rhs = 5 + offset; C.rms_rel_bs = rhs; // c_side.test_pat[real, 0, NOT] rhs = 6 + offset; C.rms_rel_ar = rhs; // c_side.test_pat[real, 0, NOT] rhs = 7 + offset; C.rms_rel_br = rhs; // c_side.test_pat[real, 0, NOT] rhs = 8 + offset; C.rms_rel_k = rhs; // c_side.test_pat[real, 0, NOT] rhs = 9 + offset; C.rms_rel_ks = rhs; // c_side.test_pat[real, 0, NOT] rhs = 10 + offset; C.rms_rel_kr = rhs; // c_side.test_pat[real, 0, NOT] rhs = 11 + offset; C.rms_phi = rhs; // c_side.test_pat[real, 0, NOT] rhs = 12 + offset; C.rms_phi_s = rhs; // c_side.test_pat[real, 0, NOT] rhs = 13 + offset; C.rms_phi_r = rhs; // c_side.test_pat[real, 0, NOT] rhs = 14 + offset; C.amp_ba_s = rhs; // c_side.test_pat[real, 0, NOT] rhs = 15 + offset; C.amp_ba_r = rhs; // c_side.test_pat[real, 0, NOT] rhs = 16 + offset; C.chi_a = rhs; // c_side.test_pat[real, 0, NOT] rhs = 17 + offset; C.chi_c = rhs; // c_side.test_pat[real, 0, NOT] rhs = 18 + offset; C.chi_ba = rhs; // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.amp_a.size(); i++) {int rhs = 101 + i + 19 + offset; C.amp_a[i] = rhs;} // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.amp_b.size(); i++) {int rhs = 101 + i + 20 + offset; C.amp_b[i] = rhs;} // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.amp_ba.size(); i++) {int rhs = 101 + i + 21 + offset; C.amp_ba[i] = rhs;} // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.coef_a.size(); i++) {int rhs = 101 + i + 22 + offset; C.coef_a[i] = rhs;} // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.coef_b.size(); i++) {int rhs = 101 + i + 23 + offset; C.coef_b[i] = rhs;} // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.coef_ba.size(); i++) {int rhs = 101 + i + 24 + offset; C.coef_ba[i] = rhs;} // c_side.test_pat[integer, 0, NOT] rhs = 25 + offset; C.n_func = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 26 + offset; C.ix_a1 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 27 + offset; C.ix_a2 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 28 + offset; C.ix_b1 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 29 + offset; C.ix_b2 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 30 + offset; C.i_a1 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 31 + offset; C.i_a2 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 32 + offset; C.i_b1 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 33 + offset; C.i_b2 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 34 + offset; C.n_a = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 35 + offset; C.n_b = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 36 + offset; C.i_wrap_pt = rhs; // c_side.test_pat[integer, 1, ALLOC] if (ix_patt < 3) C.ix_data.resize(0); else { C.ix_data.resize(3); for (unsigned int i = 0; i < C.ix_data.size(); i++) {int rhs = 101 + i + 37 + offset; C.ix_data[i] = rhs;} } // c_side.test_pat[integer, 0, NOT] rhs = 39 + offset; C.n_kick = rhs; // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.kick.resize(0); else { C.kick.resize(3); for (unsigned int i = 0; i < C.kick.size(); i++) {set_CPP_tao_wave_kick_pt_test_pattern(C.kick[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_tao_graph_test_pattern(C.graph, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_ele_test_pattern(C.ele, ix_patt); } //-------------------------------------------------------------- extern "C" void test_c_tao_wave (Opaque_tao_wave_class* F, bool& c_ok) { CPP_tao_wave C, C2; c_ok = true; tao_wave_to_c (F, C); set_CPP_tao_wave_test_pattern (C2, 1); if (C == C2) { cout << " tao_wave: C side convert F->C: Good" << endl; } else { cout << " tao_wave: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_wave_test_pattern (C2, 2); bool c_ok2; test2_f_tao_wave (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_wave_test_pattern (C, 3); if (C == C2) { cout << " tao_wave: F side convert F->C: Good" << endl; } else { cout << " tao_wave: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_wave_test_pattern (C2, 4); tao_wave_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_title (CPP_tao_title&, bool&); void set_CPP_tao_title_test_pattern (CPP_tao_title& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.title.resize(100); for (unsigned int i = 0; i < C.title.size(); i++) {int rhs = 101 + i + 1 + offset; C.title[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.x = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.y = rhs; // c_side.test_pat[character, 0, NOT] C.units.resize(16); for (unsigned int i = 0; i < C.units.size(); i++) {int rhs = 101 + i + 4 + offset; C.units[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.justify.resize(2); for (unsigned int i = 0; i < C.justify.size(); i++) {int rhs = 101 + i + 5 + offset; C.justify[i] = 'a' + rhs % 26;} // c_side.test_pat[logical, 0, NOT] rhs = 6 + offset; C.draw_it = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_title (Opaque_tao_title_class* F, bool& c_ok) { CPP_tao_title C, C2; c_ok = true; tao_title_to_c (F, C); set_CPP_tao_title_test_pattern (C2, 1); if (C == C2) { cout << " tao_title: C side convert F->C: Good" << endl; } else { cout << " tao_title: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_title_test_pattern (C2, 2); bool c_ok2; test2_f_tao_title (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_title_test_pattern (C, 3); if (C == C2) { cout << " tao_title: F side convert F->C: Good" << endl; } else { cout << " tao_title: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_title_test_pattern (C2, 4); tao_title_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_data_var_component (CPP_tao_data_var_component&, bool&); void set_CPP_tao_data_var_component_test_pattern (CPP_tao_data_var_component& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(16); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.sign = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_data_var_component (Opaque_tao_data_var_component_class* F, bool& c_ok) { CPP_tao_data_var_component C, C2; c_ok = true; tao_data_var_component_to_c (F, C); set_CPP_tao_data_var_component_test_pattern (C2, 1); if (C == C2) { cout << " tao_data_var_component: C side convert F->C: Good" << endl; } else { cout << " tao_data_var_component: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_data_var_component_test_pattern (C2, 2); bool c_ok2; test2_f_tao_data_var_component (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_data_var_component_test_pattern (C, 3); if (C == C2) { cout << " tao_data_var_component: F side convert F->C: Good" << endl; } else { cout << " tao_data_var_component: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_data_var_component_test_pattern (C2, 4); tao_data_var_component_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_histogram (CPP_tao_histogram&, bool&); void set_CPP_tao_histogram_test_pattern (CPP_tao_histogram& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[logical, 0, NOT] rhs = 1 + offset; C.density_normalized = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 2 + offset; C.weight_by_charge = (rhs % 2 == 0); // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.minimum = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.maximum = rhs; // c_side.test_pat[real, 0, NOT] rhs = 5 + offset; C.width = rhs; // c_side.test_pat[real, 0, NOT] rhs = 6 + offset; C.center = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 7 + offset; C.number = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_histogram (Opaque_tao_histogram_class* F, bool& c_ok) { CPP_tao_histogram C, C2; c_ok = true; tao_histogram_to_c (F, C); set_CPP_tao_histogram_test_pattern (C2, 1); if (C == C2) { cout << " tao_histogram: C side convert F->C: Good" << endl; } else { cout << " tao_histogram: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_histogram_test_pattern (C2, 2); bool c_ok2; test2_f_tao_histogram (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_histogram_test_pattern (C, 3); if (C == C2) { cout << " tao_histogram: F side convert F->C: Good" << endl; } else { cout << " tao_histogram: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_histogram_test_pattern (C2, 4); tao_histogram_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_curve (CPP_tao_curve&, bool&); void set_CPP_tao_curve_test_pattern (CPP_tao_curve& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_source.resize(40); for (unsigned int i = 0; i < C.data_source.size(); i++) {int rhs = 101 + i + 2 + offset; C.data_source[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_index.resize(100); for (unsigned int i = 0; i < C.data_index.size(); i++) {int rhs = 101 + i + 3 + offset; C.data_index[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_type_x.resize(100); for (unsigned int i = 0; i < C.data_type_x.size(); i++) {int rhs = 101 + i + 4 + offset; C.data_type_x[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_type_z.resize(100); for (unsigned int i = 0; i < C.data_type_z.size(); i++) {int rhs = 101 + i + 5 + offset; C.data_type_z[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_type.resize(100); for (unsigned int i = 0; i < C.data_type.size(); i++) {int rhs = 101 + i + 6 + offset; C.data_type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.ele_ref_name.resize(40); for (unsigned int i = 0; i < C.ele_ref_name.size(); i++) {int rhs = 101 + i + 7 + offset; C.ele_ref_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.legend_text.resize(40); for (unsigned int i = 0; i < C.legend_text.size(); i++) {int rhs = 101 + i + 8 + offset; C.legend_text[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.message_text.resize(40); for (unsigned int i = 0; i < C.message_text.size(); i++) {int rhs = 101 + i + 9 + offset; C.message_text[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.units.resize(40); for (unsigned int i = 0; i < C.units.size(); i++) {int rhs = 101 + i + 10 + offset; C.units[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.component.resize(60); for (unsigned int i = 0; i < C.component.size(); i++) {int rhs = 101 + i + 11 + offset; C.component[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 0, NOT] set_CPP_tao_histogram_test_pattern(C.hist, ix_patt); // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.x_line.resize(0); else { C.x_line.resize(3); for (unsigned int i = 0; i < C.x_line.size(); i++) {int rhs = 101 + i + 15 + offset; C.x_line[i] = rhs;} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.y_line.resize(0); else { C.y_line.resize(3); for (unsigned int i = 0; i < C.y_line.size(); i++) {int rhs = 101 + i + 17 + offset; C.y_line[i] = rhs;} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.y2_line.resize(0); else { C.y2_line.resize(3); for (unsigned int i = 0; i < C.y2_line.size(); i++) {int rhs = 101 + i + 19 + offset; C.y2_line[i] = rhs;} } // c_side.test_pat[integer, 1, ALLOC] if (ix_patt < 3) C.ix_line.resize(0); else { C.ix_line.resize(3); for (unsigned int i = 0; i < C.ix_line.size(); i++) {int rhs = 101 + i + 21 + offset; C.ix_line[i] = rhs;} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.x_symb.resize(0); else { C.x_symb.resize(3); for (unsigned int i = 0; i < C.x_symb.size(); i++) {int rhs = 101 + i + 23 + offset; C.x_symb[i] = rhs;} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.y_symb.resize(0); else { C.y_symb.resize(3); for (unsigned int i = 0; i < C.y_symb.size(); i++) {int rhs = 101 + i + 25 + offset; C.y_symb[i] = rhs;} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.z_symb.resize(0); else { C.z_symb.resize(3); for (unsigned int i = 0; i < C.z_symb.size(); i++) {int rhs = 101 + i + 27 + offset; C.z_symb[i] = rhs;} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.symb_size.resize(0); else { C.symb_size.resize(3); for (unsigned int i = 0; i < C.symb_size.size(); i++) {int rhs = 101 + i + 29 + offset; C.symb_size[i] = rhs;} } // c_side.test_pat[integer, 1, ALLOC] if (ix_patt < 3) C.ix_symb.resize(0); else { C.ix_symb.resize(3); for (unsigned int i = 0; i < C.ix_symb.size(); i++) {int rhs = 101 + i + 31 + offset; C.ix_symb[i] = rhs;} } // c_side.test_pat[real, 0, NOT] rhs = 33 + offset; C.y_axis_scale_factor = rhs; // c_side.test_pat[real, 0, NOT] rhs = 34 + offset; C.s = rhs; // c_side.test_pat[real, 0, NOT] rhs = 35 + offset; C.z_color0 = rhs; // c_side.test_pat[real, 0, NOT] rhs = 36 + offset; C.z_color1 = rhs; // c_side.test_pat[type, 0, NOT] set_CPP_qp_line_test_pattern(C.line, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_symbol_test_pattern(C.symbol, ix_patt); // c_side.test_pat[integer, 0, NOT] rhs = 39 + offset; C.ix_universe = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 40 + offset; C.symbol_every = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 41 + offset; C.ix_branch = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 42 + offset; C.ix_ele_ref = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 43 + offset; C.ix_ele_ref_track = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 44 + offset; C.ix_bunch = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 45 + offset; C.use_y2 = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 46 + offset; C.draw_line = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 47 + offset; C.draw_symbols = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 48 + offset; C.draw_symbol_index = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 49 + offset; C.smooth_line_calc = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 50 + offset; C.use_z_color = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 51 + offset; C.autoscale_z_color = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_curve (Opaque_tao_curve_class* F, bool& c_ok) { CPP_tao_curve C, C2; c_ok = true; tao_curve_to_c (F, C); set_CPP_tao_curve_test_pattern (C2, 1); if (C == C2) { cout << " tao_curve: C side convert F->C: Good" << endl; } else { cout << " tao_curve: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_curve_test_pattern (C2, 2); bool c_ok2; test2_f_tao_curve (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_curve_test_pattern (C, 3); if (C == C2) { cout << " tao_curve: F side convert F->C: Good" << endl; } else { cout << " tao_curve: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_curve_test_pattern (C2, 4); tao_curve_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_graph (CPP_tao_graph&, bool&); void set_CPP_tao_graph_test_pattern (CPP_tao_graph& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.type.resize(40); for (unsigned int i = 0; i < C.type.size(); i++) {int rhs = 101 + i + 2 + offset; C.type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.title.resize(100); for (unsigned int i = 0; i < C.title.size(); i++) {int rhs = 101 + i + 3 + offset; C.title[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.title_suffix.resize(100); for (unsigned int i = 0; i < C.title_suffix.size(); i++) {int rhs = 101 + i + 4 + offset; C.title_suffix[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 1, NOT] for (unsigned int i = 0; i < C.text_legend.size(); i++) { C.text_legend[i].resize(100); for (unsigned int j = 0; j < C.text_legend[i].size(); j++) {C.text_legend[i][j] = 'a' + (101 + i + 10*(j+1) + 5 + offset) % 26;} } // c_side.test_pat[character, 0, NOT] C.component.resize(60); for (unsigned int i = 0; i < C.component.size(); i++) {int rhs = 101 + i + 6 + offset; C.component[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.why_invalid.resize(80); for (unsigned int i = 0; i < C.why_invalid.size(); i++) {int rhs = 101 + i + 7 + offset; C.why_invalid[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.floor_plan_view.resize(2); for (unsigned int i = 0; i < C.floor_plan_view.size(); i++) {int rhs = 101 + i + 8 + offset; C.floor_plan_view[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.floor_plan_orbit_color.resize(16); for (unsigned int i = 0; i < C.floor_plan_orbit_color.size(); i++) {int rhs = 101 + i + 9 + offset; C.floor_plan_orbit_color[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.curve.resize(0); else { C.curve.resize(3); for (unsigned int i = 0; i < C.curve.size(); i++) {set_CPP_tao_curve_test_pattern(C.curve[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_qp_point_test_pattern(C.text_legend_origin, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_point_test_pattern(C.curve_legend_origin, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_axis_test_pattern(C.x, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_axis_test_pattern(C.y, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_axis_test_pattern(C.y2, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_rect_test_pattern(C.margin, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_qp_rect_test_pattern(C.scale_margin, ix_patt); // c_side.test_pat[real, 0, NOT] rhs = 21 + offset; C.x_axis_scale_factor = rhs; // c_side.test_pat[real, 0, NOT] rhs = 22 + offset; C.symbol_size_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 23 + offset; C.floor_plan_rotation = rhs; // c_side.test_pat[real, 0, NOT] rhs = 24 + offset; C.floor_plan_orbit_scale = rhs; // c_side.test_pat[integer, 1, NOT] for (unsigned int i = 0; i < C.box.size(); i++) {int rhs = 101 + i + 25 + offset; C.box[i] = rhs;} // c_side.test_pat[integer, 0, NOT] rhs = 26 + offset; C.ix_branch = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 27 + offset; C.ix_universe = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 28 + offset; C.clip = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 29 + offset; C.valid = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 30 + offset; C.y2_mirrors_y = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 31 + offset; C.limited = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 32 + offset; C.draw_axes = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 33 + offset; C.correct_xy_distortion = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 34 + offset; C.floor_plan_size_is_absolute = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 35 + offset; C.floor_plan_draw_only_first_pass = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 36 + offset; C.draw_curve_legend = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 37 + offset; C.draw_grid = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 38 + offset; C.allow_wrap_around = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 39 + offset; C.draw_only_good_user_data_or_vars = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_graph (Opaque_tao_graph_class* F, bool& c_ok) { CPP_tao_graph C, C2; c_ok = true; tao_graph_to_c (F, C); set_CPP_tao_graph_test_pattern (C2, 1); if (C == C2) { cout << " tao_graph: C side convert F->C: Good" << endl; } else { cout << " tao_graph: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_graph_test_pattern (C2, 2); bool c_ok2; test2_f_tao_graph (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_graph_test_pattern (C, 3); if (C == C2) { cout << " tao_graph: F side convert F->C: Good" << endl; } else { cout << " tao_graph: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_graph_test_pattern (C2, 4); tao_graph_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_plot (CPP_tao_plot&, bool&); void set_CPP_tao_plot_test_pattern (CPP_tao_plot& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.description.resize(100); for (unsigned int i = 0; i < C.description.size(); i++) {int rhs = 101 + i + 2 + offset; C.description[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.graph.resize(0); else { C.graph.resize(3); for (unsigned int i = 0; i < C.graph.size(); i++) {set_CPP_tao_graph_test_pattern(C.graph[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_qp_axis_test_pattern(C.x, ix_patt); // c_side.test_pat[integer, 0, NOT] rhs = 8 + offset; C.n_curve_pts = rhs; // c_side.test_pat[character, 0, NOT] C.type.resize(8); for (unsigned int i = 0; i < C.type.size(); i++) {int rhs = 101 + i + 9 + offset; C.type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.x_axis_type.resize(16); for (unsigned int i = 0; i < C.x_axis_type.size(); i++) {int rhs = 101 + i + 10 + offset; C.x_axis_type[i] = 'a' + rhs % 26;} // c_side.test_pat[logical, 0, NOT] rhs = 11 + offset; C.autoscale_x = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 12 + offset; C.autoscale_y = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 13 + offset; C.autoscale_gang_x = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 14 + offset; C.autoscale_gang_y = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 15 + offset; C.list_with_show_plot_command = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 16 + offset; C.phantom = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_plot (Opaque_tao_plot_class* F, bool& c_ok) { CPP_tao_plot C, C2; c_ok = true; tao_plot_to_c (F, C); set_CPP_tao_plot_test_pattern (C2, 1); if (C == C2) { cout << " tao_plot: C side convert F->C: Good" << endl; } else { cout << " tao_plot: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_test_pattern (C2, 2); bool c_ok2; test2_f_tao_plot (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_plot_test_pattern (C, 3); if (C == C2) { cout << " tao_plot: F side convert F->C: Good" << endl; } else { cout << " tao_plot: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_test_pattern (C2, 4); tao_plot_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_plot_region (CPP_tao_plot_region&, bool&); void set_CPP_tao_plot_region_test_pattern (CPP_tao_plot_region& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 0, NOT] set_CPP_tao_plot_test_pattern(C.plot, ix_patt); // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.location.size(); i++) {int rhs = 101 + i + 3 + offset; C.location[i] = rhs;} // c_side.test_pat[logical, 0, NOT] rhs = 4 + offset; C.visible = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 5 + offset; C.list_with_show_plot_command = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_plot_region (Opaque_tao_plot_region_class* F, bool& c_ok) { CPP_tao_plot_region C, C2; c_ok = true; tao_plot_region_to_c (F, C); set_CPP_tao_plot_region_test_pattern (C2, 1); if (C == C2) { cout << " tao_plot_region: C side convert F->C: Good" << endl; } else { cout << " tao_plot_region: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_region_test_pattern (C2, 2); bool c_ok2; test2_f_tao_plot_region (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_plot_region_test_pattern (C, 3); if (C == C2) { cout << " tao_plot_region: F side convert F->C: Good" << endl; } else { cout << " tao_plot_region: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_region_test_pattern (C2, 4); tao_plot_region_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_plot_page (CPP_tao_plot_page&, bool&); void set_CPP_tao_plot_page_test_pattern (CPP_tao_plot_page& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, NOT] for (unsigned int i = 0; i < C.title.size(); i++) {int rhs = 101 + i + 1 + offset; set_CPP_tao_title_test_pattern(C.title[i], ix_patt+i+1);} // c_side.test_pat[type, 0, NOT] set_CPP_qp_rect_test_pattern(C.border, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_drawing_test_pattern(C.floor_plan, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_drawing_test_pattern(C.lat_layout, ix_patt); // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.pattern.resize(0); else { C.pattern.resize(3); for (unsigned int i = 0; i < C.pattern.size(); i++) {set_CPP_tao_shape_pattern_test_pattern(C.pattern[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.plot_template.resize(0); else { C.plot_template.resize(3); for (unsigned int i = 0; i < C.plot_template.size(); i++) {set_CPP_tao_plot_test_pattern(C.plot_template[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.region.resize(0); else { C.region.resize(3); for (unsigned int i = 0; i < C.region.size(); i++) {set_CPP_tao_plot_region_test_pattern(C.region[i], ix_patt+i+1);} } // c_side.test_pat[character, 0, NOT] C.plot_display_type.resize(8); for (unsigned int i = 0; i < C.plot_display_type.size(); i++) {int rhs = 101 + i + 11 + offset; C.plot_display_type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.ps_scale.resize(80); for (unsigned int i = 0; i < C.ps_scale.size(); i++) {int rhs = 101 + i + 12 + offset; C.ps_scale[i] = 'a' + rhs % 26;} // c_side.test_pat[real, 1, NOT] for (unsigned int i = 0; i < C.size.size(); i++) {int rhs = 101 + i + 13 + offset; C.size[i] = rhs;} // c_side.test_pat[real, 0, NOT] rhs = 14 + offset; C.text_height = rhs; // c_side.test_pat[real, 0, NOT] rhs = 15 + offset; C.main_title_text_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 16 + offset; C.graph_title_text_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 17 + offset; C.axis_number_text_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 18 + offset; C.axis_label_text_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 19 + offset; C.legend_text_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 20 + offset; C.key_table_text_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 21 + offset; C.curve_legend_line_len = rhs; // c_side.test_pat[real, 0, NOT] rhs = 22 + offset; C.curve_legend_text_offset = rhs; // c_side.test_pat[real, 0, NOT] rhs = 23 + offset; C.floor_plan_shape_scale = rhs; // c_side.test_pat[real, 0, NOT] rhs = 24 + offset; C.lat_layout_shape_scale = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 25 + offset; C.n_curve_pts = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 26 + offset; C.id_window = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 27 + offset; C.delete_overlapping_plots = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_plot_page (Opaque_tao_plot_page_class* F, bool& c_ok) { CPP_tao_plot_page C, C2; c_ok = true; tao_plot_page_to_c (F, C); set_CPP_tao_plot_page_test_pattern (C2, 1); if (C == C2) { cout << " tao_plot_page: C side convert F->C: Good" << endl; } else { cout << " tao_plot_page: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_page_test_pattern (C2, 2); bool c_ok2; test2_f_tao_plot_page (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_plot_page_test_pattern (C, 3); if (C == C2) { cout << " tao_plot_page: F side convert F->C: Good" << endl; } else { cout << " tao_plot_page: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_page_test_pattern (C2, 4); tao_plot_page_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_plot_array (CPP_tao_plot_array&, bool&); void set_CPP_tao_plot_array_test_pattern (CPP_tao_plot_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_plot_array (Opaque_tao_plot_array_class* F, bool& c_ok) { CPP_tao_plot_array C, C2; c_ok = true; tao_plot_array_to_c (F, C); set_CPP_tao_plot_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_plot_array: C side convert F->C: Good" << endl; } else { cout << " tao_plot_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_plot_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_plot_array_test_pattern (C, 3); if (C == C2) { cout << " tao_plot_array: F side convert F->C: Good" << endl; } else { cout << " tao_plot_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_plot_array_test_pattern (C2, 4); tao_plot_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_graph_array (CPP_tao_graph_array&, bool&); void set_CPP_tao_graph_array_test_pattern (CPP_tao_graph_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_graph_array (Opaque_tao_graph_array_class* F, bool& c_ok) { CPP_tao_graph_array C, C2; c_ok = true; tao_graph_array_to_c (F, C); set_CPP_tao_graph_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_graph_array: C side convert F->C: Good" << endl; } else { cout << " tao_graph_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_graph_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_graph_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_graph_array_test_pattern (C, 3); if (C == C2) { cout << " tao_graph_array: F side convert F->C: Good" << endl; } else { cout << " tao_graph_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_graph_array_test_pattern (C2, 4); tao_graph_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_curve_array (CPP_tao_curve_array&, bool&); void set_CPP_tao_curve_array_test_pattern (CPP_tao_curve_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_curve_array (Opaque_tao_curve_array_class* F, bool& c_ok) { CPP_tao_curve_array C, C2; c_ok = true; tao_curve_array_to_c (F, C); set_CPP_tao_curve_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_curve_array: C side convert F->C: Good" << endl; } else { cout << " tao_curve_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_curve_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_curve_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_curve_array_test_pattern (C, 3); if (C == C2) { cout << " tao_curve_array: F side convert F->C: Good" << endl; } else { cout << " tao_curve_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_curve_array_test_pattern (C2, 4); tao_curve_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_data (CPP_tao_data&, bool&); void set_CPP_tao_data_test_pattern (CPP_tao_data& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.ele_name.resize(40); for (unsigned int i = 0; i < C.ele_name.size(); i++) {int rhs = 101 + i + 1 + offset; C.ele_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.ele_start_name.resize(40); for (unsigned int i = 0; i < C.ele_start_name.size(); i++) {int rhs = 101 + i + 2 + offset; C.ele_start_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.ele_ref_name.resize(40); for (unsigned int i = 0; i < C.ele_ref_name.size(); i++) {int rhs = 101 + i + 3 + offset; C.ele_ref_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_type.resize(300); for (unsigned int i = 0; i < C.data_type.size(); i++) {int rhs = 101 + i + 4 + offset; C.data_type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.merit_type.resize(40); for (unsigned int i = 0; i < C.merit_type.size(); i++) {int rhs = 101 + i + 5 + offset; C.merit_type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_source.resize(20); for (unsigned int i = 0; i < C.data_source.size(); i++) {int rhs = 101 + i + 6 + offset; C.data_source[i] = 'a' + rhs % 26;} // c_side.test_pat[integer, 0, NOT] rhs = 7 + offset; C.ix_bunch = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 8 + offset; C.ix_branch = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 9 + offset; C.ix_ele = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 10 + offset; C.ix_ele_start = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 11 + offset; C.ix_ele_ref = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 12 + offset; C.ix_ele_merit = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 13 + offset; C.ix_d1 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 14 + offset; C.ix_data = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 15 + offset; C.ix_dmodel = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 16 + offset; C.eval_point = rhs; // c_side.test_pat[real, 0, NOT] rhs = 17 + offset; C.meas_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 18 + offset; C.ref_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 19 + offset; C.model_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 20 + offset; C.design_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 21 + offset; C.old_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 22 + offset; C.base_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 23 + offset; C.delta_merit = rhs; // c_side.test_pat[real, 0, NOT] rhs = 24 + offset; C.weight = rhs; // c_side.test_pat[real, 0, NOT] rhs = 25 + offset; C.invalid_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 26 + offset; C.merit = rhs; // c_side.test_pat[real, 0, NOT] rhs = 27 + offset; C.s = rhs; // c_side.test_pat[real, 0, NOT] rhs = 28 + offset; C.s_offset = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 29 + offset; C.exists = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 30 + offset; C.good_model = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 31 + offset; C.good_base = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 32 + offset; C.good_design = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 33 + offset; C.good_meas = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 34 + offset; C.good_ref = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 35 + offset; C.good_user = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 36 + offset; C.good_opt = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 37 + offset; C.good_plot = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 38 + offset; C.useit_plot = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 39 + offset; C.useit_opt = (rhs % 2 == 0); // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.stack.resize(0); else { C.stack.resize(3); for (unsigned int i = 0; i < C.stack.size(); i++) {set_CPP_tao_eval_stack1_test_pattern(C.stack[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_data (Opaque_tao_data_class* F, bool& c_ok) { CPP_tao_data C, C2; c_ok = true; tao_data_to_c (F, C); set_CPP_tao_data_test_pattern (C2, 1); if (C == C2) { cout << " tao_data: C side convert F->C: Good" << endl; } else { cout << " tao_data: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_data_test_pattern (C2, 2); bool c_ok2; test2_f_tao_data (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_data_test_pattern (C, 3); if (C == C2) { cout << " tao_data: F side convert F->C: Good" << endl; } else { cout << " tao_data: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_data_test_pattern (C2, 4); tao_data_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_d1_data (CPP_tao_d1_data&, bool&); void set_CPP_tao_d1_data_test_pattern (CPP_tao_d1_data& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_tao_d1_data (Opaque_tao_d1_data_class* F, bool& c_ok) { CPP_tao_d1_data C, C2; c_ok = true; tao_d1_data_to_c (F, C); set_CPP_tao_d1_data_test_pattern (C2, 1); if (C == C2) { cout << " tao_d1_data: C side convert F->C: Good" << endl; } else { cout << " tao_d1_data: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d1_data_test_pattern (C2, 2); bool c_ok2; test2_f_tao_d1_data (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_d1_data_test_pattern (C, 3); if (C == C2) { cout << " tao_d1_data: F side convert F->C: Good" << endl; } else { cout << " tao_d1_data: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d1_data_test_pattern (C2, 4); tao_d1_data_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_d2_data (CPP_tao_d2_data&, bool&); void set_CPP_tao_d2_data_test_pattern (CPP_tao_d2_data& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_file_name.resize(200); for (unsigned int i = 0; i < C.data_file_name.size(); i++) {int rhs = 101 + i + 2 + offset; C.data_file_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.ref_file_name.resize(200); for (unsigned int i = 0; i < C.ref_file_name.size(); i++) {int rhs = 101 + i + 3 + offset; C.ref_file_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_date.resize(20); for (unsigned int i = 0; i < C.data_date.size(); i++) {int rhs = 101 + i + 4 + offset; C.data_date[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.ref_date.resize(20); for (unsigned int i = 0; i < C.ref_date.size(); i++) {int rhs = 101 + i + 5 + offset; C.ref_date[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 1, NOT] for (unsigned int i = 0; i < C.descrip.size(); i++) { C.descrip[i].resize(80); for (unsigned int j = 0; j < C.descrip[i].size(); j++) {C.descrip[i][j] = 'a' + (101 + i + 10*(j+1) + 6 + offset) % 26;} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.d1.resize(0); else { C.d1.resize(3); for (unsigned int i = 0; i < C.d1.size(); i++) {set_CPP_tao_d1_data_test_pattern(C.d1[i], ix_patt+i+1);} } // c_side.test_pat[integer, 0, NOT] rhs = 9 + offset; C.ix_uni = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 10 + offset; C.ix_d2_data = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 11 + offset; C.ix_data = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 12 + offset; C.ix_ref = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 13 + offset; C.data_read_in = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 14 + offset; C.ref_read_in = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_d2_data (Opaque_tao_d2_data_class* F, bool& c_ok) { CPP_tao_d2_data C, C2; c_ok = true; tao_d2_data_to_c (F, C); set_CPP_tao_d2_data_test_pattern (C2, 1); if (C == C2) { cout << " tao_d2_data: C side convert F->C: Good" << endl; } else { cout << " tao_d2_data: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d2_data_test_pattern (C2, 2); bool c_ok2; test2_f_tao_d2_data (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_d2_data_test_pattern (C, 3); if (C == C2) { cout << " tao_d2_data: F side convert F->C: Good" << endl; } else { cout << " tao_d2_data: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d2_data_test_pattern (C2, 4); tao_d2_data_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_data_array (CPP_tao_data_array&, bool&); void set_CPP_tao_data_array_test_pattern (CPP_tao_data_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_data_array (Opaque_tao_data_array_class* F, bool& c_ok) { CPP_tao_data_array C, C2; c_ok = true; tao_data_array_to_c (F, C); set_CPP_tao_data_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_data_array: C side convert F->C: Good" << endl; } else { cout << " tao_data_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_data_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_data_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_data_array_test_pattern (C, 3); if (C == C2) { cout << " tao_data_array: F side convert F->C: Good" << endl; } else { cout << " tao_data_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_data_array_test_pattern (C2, 4); tao_data_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_d1_data_array (CPP_tao_d1_data_array&, bool&); void set_CPP_tao_d1_data_array_test_pattern (CPP_tao_d1_data_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_d1_data_array (Opaque_tao_d1_data_array_class* F, bool& c_ok) { CPP_tao_d1_data_array C, C2; c_ok = true; tao_d1_data_array_to_c (F, C); set_CPP_tao_d1_data_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_d1_data_array: C side convert F->C: Good" << endl; } else { cout << " tao_d1_data_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d1_data_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_d1_data_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_d1_data_array_test_pattern (C, 3); if (C == C2) { cout << " tao_d1_data_array: F side convert F->C: Good" << endl; } else { cout << " tao_d1_data_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d1_data_array_test_pattern (C2, 4); tao_d1_data_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_d2_data_array (CPP_tao_d2_data_array&, bool&); void set_CPP_tao_d2_data_array_test_pattern (CPP_tao_d2_data_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_d2_data_array (Opaque_tao_d2_data_array_class* F, bool& c_ok) { CPP_tao_d2_data_array C, C2; c_ok = true; tao_d2_data_array_to_c (F, C); set_CPP_tao_d2_data_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_d2_data_array: C side convert F->C: Good" << endl; } else { cout << " tao_d2_data_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d2_data_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_d2_data_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_d2_data_array_test_pattern (C, 3); if (C == C2) { cout << " tao_d2_data_array: F side convert F->C: Good" << endl; } else { cout << " tao_d2_data_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_d2_data_array_test_pattern (C2, 4); tao_d2_data_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_var_slave (CPP_tao_var_slave&, bool&); void set_CPP_tao_var_slave_test_pattern (CPP_tao_var_slave& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[integer, 0, NOT] rhs = 1 + offset; C.ix_uni = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 2 + offset; C.ix_branch = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 3 + offset; C.ix_ele = rhs; // c_side.test_pat[real, 0, PTR] if (ix_patt < 3) C.model_value = NULL; else { C.model_value = new Real; rhs = 4 + offset; (*C.model_value) = rhs; } // c_side.test_pat[real, 0, PTR] if (ix_patt < 3) C.base_value = NULL; else { C.base_value = new Real; rhs = 6 + offset; (*C.base_value) = rhs; } } //-------------------------------------------------------------- extern "C" void test_c_tao_var_slave (Opaque_tao_var_slave_class* F, bool& c_ok) { CPP_tao_var_slave C, C2; c_ok = true; tao_var_slave_to_c (F, C); set_CPP_tao_var_slave_test_pattern (C2, 1); if (C == C2) { cout << " tao_var_slave: C side convert F->C: Good" << endl; } else { cout << " tao_var_slave: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_var_slave_test_pattern (C2, 2); bool c_ok2; test2_f_tao_var_slave (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_var_slave_test_pattern (C, 3); if (C == C2) { cout << " tao_var_slave: F side convert F->C: Good" << endl; } else { cout << " tao_var_slave: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_var_slave_test_pattern (C2, 4); tao_var_slave_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_var (CPP_tao_var&, bool&); void set_CPP_tao_var_test_pattern (CPP_tao_var& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.ele_name.resize(40); for (unsigned int i = 0; i < C.ele_name.size(); i++) {int rhs = 101 + i + 1 + offset; C.ele_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.attrib_name.resize(40); for (unsigned int i = 0; i < C.attrib_name.size(); i++) {int rhs = 101 + i + 2 + offset; C.attrib_name[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.slave.resize(0); else { C.slave.resize(3); for (unsigned int i = 0; i < C.slave.size(); i++) {set_CPP_tao_var_slave_test_pattern(C.slave[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_tao_var_slave_test_pattern(C.common_slave, ix_patt); // c_side.test_pat[integer, 0, NOT] rhs = 6 + offset; C.ix_v1 = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 7 + offset; C.ix_var = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 8 + offset; C.ix_dvar = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 9 + offset; C.ix_attrib = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 10 + offset; C.ix_key_table = rhs; // c_side.test_pat[real, 0, NOT] rhs = 15 + offset; C.design_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 16 + offset; C.scratch_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 17 + offset; C.old_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 18 + offset; C.meas_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 19 + offset; C.ref_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 20 + offset; C.correction_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 21 + offset; C.high_lim = rhs; // c_side.test_pat[real, 0, NOT] rhs = 22 + offset; C.low_lim = rhs; // c_side.test_pat[real, 0, NOT] rhs = 23 + offset; C.step = rhs; // c_side.test_pat[real, 0, NOT] rhs = 24 + offset; C.weight = rhs; // c_side.test_pat[real, 0, NOT] rhs = 25 + offset; C.delta_merit = rhs; // c_side.test_pat[real, 0, NOT] rhs = 26 + offset; C.merit = rhs; // c_side.test_pat[real, 0, NOT] rhs = 27 + offset; C.dmerit_dvar = rhs; // c_side.test_pat[real, 0, NOT] rhs = 28 + offset; C.key_val0 = rhs; // c_side.test_pat[real, 0, NOT] rhs = 29 + offset; C.key_delta = rhs; // c_side.test_pat[real, 0, NOT] rhs = 30 + offset; C.s = rhs; // c_side.test_pat[character, 0, NOT] C.merit_type.resize(40); for (unsigned int i = 0; i < C.merit_type.size(); i++) {int rhs = 101 + i + 31 + offset; C.merit_type[i] = 'a' + rhs % 26;} // c_side.test_pat[logical, 0, NOT] rhs = 32 + offset; C.exists = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 33 + offset; C.good_var = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 34 + offset; C.good_user = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 35 + offset; C.good_opt = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 36 + offset; C.good_plot = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 37 + offset; C.useit_opt = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 38 + offset; C.useit_plot = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 39 + offset; C.key_bound = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_var (Opaque_tao_var_class* F, bool& c_ok) { CPP_tao_var C, C2; c_ok = true; tao_var_to_c (F, C); set_CPP_tao_var_test_pattern (C2, 1); if (C == C2) { cout << " tao_var: C side convert F->C: Good" << endl; } else { cout << " tao_var: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_var_test_pattern (C2, 2); bool c_ok2; test2_f_tao_var (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_var_test_pattern (C, 3); if (C == C2) { cout << " tao_var: F side convert F->C: Good" << endl; } else { cout << " tao_var: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_var_test_pattern (C2, 4); tao_var_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_v1_var (CPP_tao_v1_var&, bool&); void set_CPP_tao_v1_var_test_pattern (CPP_tao_v1_var& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[integer, 0, NOT] rhs = 2 + offset; C.ix_v1_var = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_v1_var (Opaque_tao_v1_var_class* F, bool& c_ok) { CPP_tao_v1_var C, C2; c_ok = true; tao_v1_var_to_c (F, C); set_CPP_tao_v1_var_test_pattern (C2, 1); if (C == C2) { cout << " tao_v1_var: C side convert F->C: Good" << endl; } else { cout << " tao_v1_var: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_v1_var_test_pattern (C2, 2); bool c_ok2; test2_f_tao_v1_var (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_v1_var_test_pattern (C, 3); if (C == C2) { cout << " tao_v1_var: F side convert F->C: Good" << endl; } else { cout << " tao_v1_var: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_v1_var_test_pattern (C2, 4); tao_v1_var_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_var_array (CPP_tao_var_array&, bool&); void set_CPP_tao_var_array_test_pattern (CPP_tao_var_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_var_array (Opaque_tao_var_array_class* F, bool& c_ok) { CPP_tao_var_array C, C2; c_ok = true; tao_var_array_to_c (F, C); set_CPP_tao_var_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_var_array: C side convert F->C: Good" << endl; } else { cout << " tao_var_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_var_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_var_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_var_array_test_pattern (C, 3); if (C == C2) { cout << " tao_var_array: F side convert F->C: Good" << endl; } else { cout << " tao_var_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_var_array_test_pattern (C2, 4); tao_var_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_v1_var_array (CPP_tao_v1_var_array&, bool&); void set_CPP_tao_v1_var_array_test_pattern (CPP_tao_v1_var_array& C, int ix_patt) { int rhs, offset = 100 * ix_patt; } //-------------------------------------------------------------- extern "C" void test_c_tao_v1_var_array (Opaque_tao_v1_var_array_class* F, bool& c_ok) { CPP_tao_v1_var_array C, C2; c_ok = true; tao_v1_var_array_to_c (F, C); set_CPP_tao_v1_var_array_test_pattern (C2, 1); if (C == C2) { cout << " tao_v1_var_array: C side convert F->C: Good" << endl; } else { cout << " tao_v1_var_array: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_v1_var_array_test_pattern (C2, 2); bool c_ok2; test2_f_tao_v1_var_array (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_v1_var_array_test_pattern (C, 3); if (C == C2) { cout << " tao_v1_var_array: F side convert F->C: Good" << endl; } else { cout << " tao_v1_var_array: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_v1_var_array_test_pattern (C2, 4); tao_v1_var_array_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_building_wall_point (CPP_tao_building_wall_point&, bool&); void set_CPP_tao_building_wall_point_test_pattern (CPP_tao_building_wall_point& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.z = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.x = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.radius = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.z_center = rhs; // c_side.test_pat[real, 0, NOT] rhs = 5 + offset; C.x_center = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_building_wall_point (Opaque_tao_building_wall_point_class* F, bool& c_ok) { CPP_tao_building_wall_point C, C2; c_ok = true; tao_building_wall_point_to_c (F, C); set_CPP_tao_building_wall_point_test_pattern (C2, 1); if (C == C2) { cout << " tao_building_wall_point: C side convert F->C: Good" << endl; } else { cout << " tao_building_wall_point: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_building_wall_point_test_pattern (C2, 2); bool c_ok2; test2_f_tao_building_wall_point (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_building_wall_point_test_pattern (C, 3); if (C == C2) { cout << " tao_building_wall_point: F side convert F->C: Good" << endl; } else { cout << " tao_building_wall_point: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_building_wall_point_test_pattern (C2, 4); tao_building_wall_point_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_building_wall_section (CPP_tao_building_wall_section&, bool&); void set_CPP_tao_building_wall_section_test_pattern (CPP_tao_building_wall_section& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.constraint.resize(16); for (unsigned int i = 0; i < C.constraint.size(); i++) {int rhs = 101 + i + 1 + offset; C.constraint[i] = 'a' + rhs % 26;} // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.point.resize(0); else { C.point.resize(3); for (unsigned int i = 0; i < C.point.size(); i++) {set_CPP_tao_building_wall_point_test_pattern(C.point[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_building_wall_section (Opaque_tao_building_wall_section_class* F, bool& c_ok) { CPP_tao_building_wall_section C, C2; c_ok = true; tao_building_wall_section_to_c (F, C); set_CPP_tao_building_wall_section_test_pattern (C2, 1); if (C == C2) { cout << " tao_building_wall_section: C side convert F->C: Good" << endl; } else { cout << " tao_building_wall_section: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_building_wall_section_test_pattern (C2, 2); bool c_ok2; test2_f_tao_building_wall_section (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_building_wall_section_test_pattern (C, 3); if (C == C2) { cout << " tao_building_wall_section: F side convert F->C: Good" << endl; } else { cout << " tao_building_wall_section: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_building_wall_section_test_pattern (C2, 4); tao_building_wall_section_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_building_wall (CPP_tao_building_wall&, bool&); void set_CPP_tao_building_wall_test_pattern (CPP_tao_building_wall& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.section.resize(0); else { C.section.resize(3); for (unsigned int i = 0; i < C.section.size(); i++) {set_CPP_tao_building_wall_section_test_pattern(C.section[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_building_wall (Opaque_tao_building_wall_class* F, bool& c_ok) { CPP_tao_building_wall C, C2; c_ok = true; tao_building_wall_to_c (F, C); set_CPP_tao_building_wall_test_pattern (C2, 1); if (C == C2) { cout << " tao_building_wall: C side convert F->C: Good" << endl; } else { cout << " tao_building_wall: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_building_wall_test_pattern (C2, 2); bool c_ok2; test2_f_tao_building_wall (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_building_wall_test_pattern (C, 3); if (C == C2) { cout << " tao_building_wall: F side convert F->C: Good" << endl; } else { cout << " tao_building_wall: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_building_wall_test_pattern (C2, 4); tao_building_wall_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_global (CPP_tao_global&, bool&); void set_CPP_tao_global_test_pattern (CPP_tao_global& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.y_axis_plot_dmin = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.lm_opt_deriv_reinit = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.de_lm_step_ratio = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.de_var_to_population_factor = rhs; // c_side.test_pat[real, 0, NOT] rhs = 5 + offset; C.lmdif_eps = rhs; // c_side.test_pat[real, 0, NOT] rhs = 6 + offset; C.svd_cutoff = rhs; // c_side.test_pat[real, 0, NOT] rhs = 7 + offset; C.unstable_penalty = rhs; // c_side.test_pat[real, 0, NOT] rhs = 8 + offset; C.merit_stop_value = rhs; // c_side.test_pat[real, 0, NOT] rhs = 9 + offset; C.random_sigma_cutoff = rhs; // c_side.test_pat[real, 0, NOT] rhs = 10 + offset; C.delta_e_chrom = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 11 + offset; C.n_opti_cycles = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 12 + offset; C.n_opti_loops = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 13 + offset; C.phase_units = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 14 + offset; C.bunch_to_plot = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 15 + offset; C.random_seed = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 16 + offset; C.n_top10 = rhs; // c_side.test_pat[character, 0, NOT] C.random_engine.resize(16); for (unsigned int i = 0; i < C.random_engine.size(); i++) {int rhs = 101 + i + 17 + offset; C.random_engine[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.random_gauss_converter.resize(16); for (unsigned int i = 0; i < C.random_gauss_converter.size(); i++) {int rhs = 101 + i + 18 + offset; C.random_gauss_converter[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.track_type.resize(16); for (unsigned int i = 0; i < C.track_type.size(); i++) {int rhs = 101 + i + 19 + offset; C.track_type[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.prompt_string.resize(40); for (unsigned int i = 0; i < C.prompt_string.size(); i++) {int rhs = 101 + i + 20 + offset; C.prompt_string[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.prompt_color.resize(16); for (unsigned int i = 0; i < C.prompt_color.size(); i++) {int rhs = 101 + i + 21 + offset; C.prompt_color[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.optimizer.resize(16); for (unsigned int i = 0; i < C.optimizer.size(); i++) {int rhs = 101 + i + 22 + offset; C.optimizer[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.print_command.resize(40); for (unsigned int i = 0; i < C.print_command.size(); i++) {int rhs = 101 + i + 23 + offset; C.print_command[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.var_out_file.resize(80); for (unsigned int i = 0; i < C.var_out_file.size(); i++) {int rhs = 101 + i + 24 + offset; C.var_out_file[i] = 'a' + rhs % 26;} // c_side.test_pat[logical, 0, NOT] rhs = 25 + offset; C.initialized = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 26 + offset; C.opt_with_ref = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 27 + offset; C.opt_with_base = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 28 + offset; C.label_lattice_elements = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 29 + offset; C.label_keys = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 30 + offset; C.derivative_recalc = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 31 + offset; C.derivative_uses_design = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 32 + offset; C.init_plot_needed = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 33 + offset; C.orm_analysis = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 34 + offset; C.plot_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 35 + offset; C.lattice_calc_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 36 + offset; C.svd_retreat_on_merit_increase = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 37 + offset; C.stop_on_error = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 38 + offset; C.command_file_print_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 39 + offset; C.box_plots = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 40 + offset; C.beam_timer_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 41 + offset; C.var_limits_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 42 + offset; C.only_limit_opt_vars = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 43 + offset; C.optimizer_var_limit_warn = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 44 + offset; C.rf_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 45 + offset; C.draw_curve_off_scale_warn = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 46 + offset; C.wait_for_cr_in_single_mode = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 47 + offset; C.disable_smooth_line_calc = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 48 + offset; C.debug_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 49 + offset; C.single_step = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 50 + offset; C.optimizer_allow_user_abort = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 51 + offset; C.quiet = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_global (Opaque_tao_global_class* F, bool& c_ok) { CPP_tao_global C, C2; c_ok = true; tao_global_to_c (F, C); set_CPP_tao_global_test_pattern (C2, 1); if (C == C2) { cout << " tao_global: C side convert F->C: Good" << endl; } else { cout << " tao_global: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_global_test_pattern (C2, 2); bool c_ok2; test2_f_tao_global (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_global_test_pattern (C, 3); if (C == C2) { cout << " tao_global: F side convert F->C: Good" << endl; } else { cout << " tao_global: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_global_test_pattern (C2, 4); tao_global_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_alias (CPP_tao_alias&, bool&); void set_CPP_tao_alias_test_pattern (CPP_tao_alias& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(40); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.expanded_str.resize(200); for (unsigned int i = 0; i < C.expanded_str.size(); i++) {int rhs = 101 + i + 2 + offset; C.expanded_str[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_tao_alias (Opaque_tao_alias_class* F, bool& c_ok) { CPP_tao_alias C, C2; c_ok = true; tao_alias_to_c (F, C); set_CPP_tao_alias_test_pattern (C2, 1); if (C == C2) { cout << " tao_alias: C side convert F->C: Good" << endl; } else { cout << " tao_alias: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_alias_test_pattern (C2, 2); bool c_ok2; test2_f_tao_alias (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_alias_test_pattern (C, 3); if (C == C2) { cout << " tao_alias: F side convert F->C: Good" << endl; } else { cout << " tao_alias: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_alias_test_pattern (C2, 4); tao_alias_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_command_file (CPP_tao_command_file&, bool&); void set_CPP_tao_command_file_test_pattern (CPP_tao_command_file& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[character, 0, NOT] C.name.resize(200); for (unsigned int i = 0; i < C.name.size(); i++) {int rhs = 101 + i + 1 + offset; C.name[i] = 'a' + rhs % 26;} // c_side.test_pat[integer, 0, NOT] rhs = 2 + offset; C.ix_unit = rhs; // c_side.test_pat[character, 1, NOT] for (unsigned int i = 0; i < C.cmd_arg.size(); i++) { C.cmd_arg[i].resize(40); for (unsigned int j = 0; j < C.cmd_arg[i].size(); j++) {C.cmd_arg[i][j] = 'a' + (101 + i + 10*(j+1) + 3 + offset) % 26;} } // c_side.test_pat[logical, 0, NOT] rhs = 4 + offset; C.paused = (rhs % 2 == 0); // c_side.test_pat[integer, 0, NOT] rhs = 5 + offset; C.n_line = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_command_file (Opaque_tao_command_file_class* F, bool& c_ok) { CPP_tao_command_file C, C2; c_ok = true; tao_command_file_to_c (F, C); set_CPP_tao_command_file_test_pattern (C2, 1); if (C == C2) { cout << " tao_command_file: C side convert F->C: Good" << endl; } else { cout << " tao_command_file: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_command_file_test_pattern (C2, 2); bool c_ok2; test2_f_tao_command_file (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_command_file_test_pattern (C, 3); if (C == C2) { cout << " tao_command_file: F side convert F->C: Good" << endl; } else { cout << " tao_command_file: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_command_file_test_pattern (C2, 4); tao_command_file_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_common (CPP_tao_common&, bool&); void set_CPP_tao_common_test_pattern (CPP_tao_common& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, NOT] for (unsigned int i = 0; i < C.alias.size(); i++) {int rhs = 101 + i + 1 + offset; set_CPP_tao_alias_test_pattern(C.alias[i], ix_patt+i+1);} // c_side.test_pat[type, 1, NOT] for (unsigned int i = 0; i < C.key.size(); i++) {int rhs = 101 + i + 2 + offset; set_CPP_tao_alias_test_pattern(C.key[i], ix_patt+i+1);} // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.cmd_file.resize(0); else { C.cmd_file.resize(3); for (unsigned int i = 0; i < C.cmd_file.size(); i++) {set_CPP_tao_command_file_test_pattern(C.cmd_file[i], ix_patt+i+1);} } // c_side.test_pat[real, 2, ALLOC] if (ix_patt < 3) C.covar.resize(0); else { C.covar.resize(3); for (unsigned int i = 0; i < C.covar.size(); i++) C.covar[i].resize(2); for (unsigned int i = 0; i < C.covar.size(); i++) for (unsigned int j = 0; j < C.covar[0].size(); j++) {int rhs = 101 + i + 10*(j+1) + 7 + offset; C.covar[i][j] = rhs;} } // c_side.test_pat[real, 2, ALLOC] if (ix_patt < 3) C.alpha.resize(0); else { C.alpha.resize(3); for (unsigned int i = 0; i < C.alpha.size(); i++) C.alpha[i].resize(2); for (unsigned int i = 0; i < C.alpha.size(); i++) for (unsigned int j = 0; j < C.alpha[0].size(); j++) {int rhs = 101 + i + 10*(j+1) + 10 + offset; C.alpha[i][j] = rhs;} } // c_side.test_pat[real, 0, NOT] rhs = 13 + offset; C.dummy_target = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 14 + offset; C.ix_ref_taylor = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 15 + offset; C.ix_ele_taylor = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 16 + offset; C.n_alias = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 17 + offset; C.cmd_file_level = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 18 + offset; C.ix_key_bank = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 19 + offset; C.n_universes = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 20 + offset; C.default_universe = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 21 + offset; C.default_branch = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 22 + offset; C.ix_history = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 23 + offset; C.n_history = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 24 + offset; C.cmd_file_paused = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 25 + offset; C.use_cmd_here = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 26 + offset; C.multi_commands_here = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 27 + offset; C.cmd_from_cmd_file = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 28 + offset; C.use_saved_beam_in_tracking = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 29 + offset; C.single_mode = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 30 + offset; C.combine_consecutive_elements_of_like_name = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 31 + offset; C.common_lattice = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 32 + offset; C.init_beam = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 33 + offset; C.init_var = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 34 + offset; C.init_read_lat_info = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 35 + offset; C.init_data = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 36 + offset; C.parse_cmd_args = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 37 + offset; C.optimizer_running = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 38 + offset; C.have_datums_using_expressions = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 39 + offset; C.noplot_arg_set = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 40 + offset; C.init_tao_file_arg_set = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 41 + offset; C.log_startup = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 42 + offset; C.print_to_terminal = (rhs % 2 == 0); // c_side.test_pat[character, 0, NOT] C.cmd.resize(100); for (unsigned int i = 0; i < C.cmd.size(); i++) {int rhs = 101 + i + 43 + offset; C.cmd[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.init_name.resize(16); for (unsigned int i = 0; i < C.init_name.size(); i++) {int rhs = 101 + i + 44 + offset; C.init_name[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.lat_file.resize(200); for (unsigned int i = 0; i < C.lat_file.size(); i++) {int rhs = 101 + i + 45 + offset; C.lat_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.init_tao_file.resize(100); for (unsigned int i = 0; i < C.init_tao_file.size(); i++) {int rhs = 101 + i + 46 + offset; C.init_tao_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.init_tao_file_path.resize(200); for (unsigned int i = 0; i < C.init_tao_file_path.size(); i++) {int rhs = 101 + i + 47 + offset; C.init_tao_file_path[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.beam_file.resize(100); for (unsigned int i = 0; i < C.beam_file.size(); i++) {int rhs = 101 + i + 48 + offset; C.beam_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.beam_all_file.resize(100); for (unsigned int i = 0; i < C.beam_all_file.size(); i++) {int rhs = 101 + i + 49 + offset; C.beam_all_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.beam0_file.resize(100); for (unsigned int i = 0; i < C.beam0_file.size(); i++) {int rhs = 101 + i + 50 + offset; C.beam0_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.data_file.resize(100); for (unsigned int i = 0; i < C.data_file.size(); i++) {int rhs = 101 + i + 51 + offset; C.data_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.plot_file.resize(100); for (unsigned int i = 0; i < C.plot_file.size(); i++) {int rhs = 101 + i + 52 + offset; C.plot_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.startup_file.resize(100); for (unsigned int i = 0; i < C.startup_file.size(); i++) {int rhs = 101 + i + 53 + offset; C.startup_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.var_file.resize(100); for (unsigned int i = 0; i < C.var_file.size(); i++) {int rhs = 101 + i + 54 + offset; C.var_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.building_wall_file.resize(100); for (unsigned int i = 0; i < C.building_wall_file.size(); i++) {int rhs = 101 + i + 55 + offset; C.building_wall_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.hook_init_file.resize(100); for (unsigned int i = 0; i < C.hook_init_file.size(); i++) {int rhs = 101 + i + 56 + offset; C.hook_init_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.plot_geometry.resize(16); for (unsigned int i = 0; i < C.plot_geometry.size(); i++) {int rhs = 101 + i + 57 + offset; C.plot_geometry[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.single_mode_buffer.resize(80); for (unsigned int i = 0; i < C.single_mode_buffer.size(); i++) {int rhs = 101 + i + 58 + offset; C.single_mode_buffer[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.unique_name_suffix.resize(40); for (unsigned int i = 0; i < C.unique_name_suffix.size(); i++) {int rhs = 101 + i + 59 + offset; C.unique_name_suffix[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 1, NOT] for (unsigned int i = 0; i < C.valid_plot_who.size(); i++) { C.valid_plot_who[i].resize(16); for (unsigned int j = 0; j < C.valid_plot_who[i].size(); j++) {C.valid_plot_who[i][j] = 'a' + (101 + i + 10*(j+1) + 60 + offset) % 26;} } } //-------------------------------------------------------------- extern "C" void test_c_tao_common (Opaque_tao_common_class* F, bool& c_ok) { CPP_tao_common C, C2; c_ok = true; tao_common_to_c (F, C); set_CPP_tao_common_test_pattern (C2, 1); if (C == C2) { cout << " tao_common: C side convert F->C: Good" << endl; } else { cout << " tao_common: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_common_test_pattern (C2, 2); bool c_ok2; test2_f_tao_common (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_common_test_pattern (C, 3); if (C == C2) { cout << " tao_common: F side convert F->C: Good" << endl; } else { cout << " tao_common: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_common_test_pattern (C2, 4); tao_common_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_lat_mode (CPP_tao_lat_mode&, bool&); void set_CPP_tao_lat_mode_test_pattern (CPP_tao_lat_mode& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.chrom = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.growth_rate = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_lat_mode (Opaque_tao_lat_mode_class* F, bool& c_ok) { CPP_tao_lat_mode C, C2; c_ok = true; tao_lat_mode_to_c (F, C); set_CPP_tao_lat_mode_test_pattern (C2, 1); if (C == C2) { cout << " tao_lat_mode: C side convert F->C: Good" << endl; } else { cout << " tao_lat_mode: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_lat_mode_test_pattern (C2, 2); bool c_ok2; test2_f_tao_lat_mode (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_lat_mode_test_pattern (C, 3); if (C == C2) { cout << " tao_lat_mode: F side convert F->C: Good" << endl; } else { cout << " tao_lat_mode: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_lat_mode_test_pattern (C2, 4); tao_lat_mode_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_sigma_mat (CPP_tao_sigma_mat&, bool&); void set_CPP_tao_sigma_mat_test_pattern (CPP_tao_sigma_mat& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 2, NOT] for (unsigned int i = 0; i < C.sigma.size(); i++) for (unsigned int j = 0; j < C.sigma[0].size(); j++) {int rhs = 101 + i + 10*(j+1) + 1 + offset; C.sigma[i][j] = rhs;} } //-------------------------------------------------------------- extern "C" void test_c_tao_sigma_mat (Opaque_tao_sigma_mat_class* F, bool& c_ok) { CPP_tao_sigma_mat C, C2; c_ok = true; tao_sigma_mat_to_c (F, C); set_CPP_tao_sigma_mat_test_pattern (C2, 1); if (C == C2) { cout << " tao_sigma_mat: C side convert F->C: Good" << endl; } else { cout << " tao_sigma_mat: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_sigma_mat_test_pattern (C2, 2); bool c_ok2; test2_f_tao_sigma_mat (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_sigma_mat_test_pattern (C, 3); if (C == C2) { cout << " tao_sigma_mat: F side convert F->C: Good" << endl; } else { cout << " tao_sigma_mat: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_sigma_mat_test_pattern (C2, 4); tao_sigma_mat_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_lattice_branch (CPP_tao_lattice_branch&, bool&); void set_CPP_tao_lattice_branch_test_pattern (CPP_tao_lattice_branch& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.bunch_params.resize(0); else { C.bunch_params.resize(3); for (unsigned int i = 0; i < C.bunch_params.size(); i++) {set_CPP_bunch_params_test_pattern(C.bunch_params[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.linear.resize(0); else { C.linear.resize(3); for (unsigned int i = 0; i < C.linear.size(); i++) {set_CPP_tao_sigma_mat_test_pattern(C.linear[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.orbit.resize(0); else { C.orbit.resize(3); for (unsigned int i = 0; i < C.orbit.size(); i++) {set_CPP_coord_test_pattern(C.orbit[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_coord_test_pattern(C.orb0, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_lat_test_pattern(C.high_e_lat, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_lat_test_pattern(C.low_e_lat, ix_patt); // c_side.test_pat[integer, 0, NOT] rhs = 10 + offset; C.track_state = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 11 + offset; C.has_open_match_element = (rhs % 2 == 0); // c_side.test_pat[type, 0, NOT] set_CPP_normal_modes_test_pattern(C.modes, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_rad_int_all_ele_test_pattern(C.rad_int, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_lat_mode_test_pattern(C.a, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_lat_mode_test_pattern(C.b, ix_patt); // c_side.test_pat[integer, 0, NOT] rhs = 16 + offset; C.ix_rad_int_cache = rhs; // c_side.test_pat[type, 0, NOT] set_CPP_normal_modes_test_pattern(C.modes_rf_on, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_rad_int_all_ele_test_pattern(C.rad_int_rf_on, ix_patt); } //-------------------------------------------------------------- extern "C" void test_c_tao_lattice_branch (Opaque_tao_lattice_branch_class* F, bool& c_ok) { CPP_tao_lattice_branch C, C2; c_ok = true; tao_lattice_branch_to_c (F, C); set_CPP_tao_lattice_branch_test_pattern (C2, 1); if (C == C2) { cout << " tao_lattice_branch: C side convert F->C: Good" << endl; } else { cout << " tao_lattice_branch: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_lattice_branch_test_pattern (C2, 2); bool c_ok2; test2_f_tao_lattice_branch (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_lattice_branch_test_pattern (C, 3); if (C == C2) { cout << " tao_lattice_branch: F side convert F->C: Good" << endl; } else { cout << " tao_lattice_branch: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_lattice_branch_test_pattern (C2, 4); tao_lattice_branch_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_lattice (CPP_tao_lattice&, bool&); void set_CPP_tao_lattice_test_pattern (CPP_tao_lattice& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 0, NOT] set_CPP_lat_test_pattern(C.lat, ix_patt); // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.tao_branch.resize(0); else { C.tao_branch.resize(3); for (unsigned int i = 0; i < C.tao_branch.size(); i++) {set_CPP_tao_lattice_branch_test_pattern(C.tao_branch[i], ix_patt+i+1);} } } //-------------------------------------------------------------- extern "C" void test_c_tao_lattice (Opaque_tao_lattice_class* F, bool& c_ok) { CPP_tao_lattice C, C2; c_ok = true; tao_lattice_to_c (F, C); set_CPP_tao_lattice_test_pattern (C2, 1); if (C == C2) { cout << " tao_lattice: C side convert F->C: Good" << endl; } else { cout << " tao_lattice: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_lattice_test_pattern (C2, 2); bool c_ok2; test2_f_tao_lattice (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_lattice_test_pattern (C, 3); if (C == C2) { cout << " tao_lattice: F side convert F->C: Good" << endl; } else { cout << " tao_lattice: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_lattice_test_pattern (C2, 4); tao_lattice_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_element (CPP_tao_element&, bool&); void set_CPP_tao_element_test_pattern (CPP_tao_element& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 0, NOT] set_CPP_beam_test_pattern(C.beam, ix_patt); // c_side.test_pat[logical, 0, NOT] rhs = 2 + offset; C.save_beam = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_element (Opaque_tao_element_class* F, bool& c_ok) { CPP_tao_element C, C2; c_ok = true; tao_element_to_c (F, C); set_CPP_tao_element_test_pattern (C2, 1); if (C == C2) { cout << " tao_element: C side convert F->C: Good" << endl; } else { cout << " tao_element: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_element_test_pattern (C2, 2); bool c_ok2; test2_f_tao_element (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_element_test_pattern (C, 3); if (C == C2) { cout << " tao_element: F side convert F->C: Good" << endl; } else { cout << " tao_element: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_element_test_pattern (C2, 4); tao_element_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_ping_scale (CPP_tao_ping_scale&, bool&); void set_CPP_tao_ping_scale_test_pattern (CPP_tao_ping_scale& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[real, 0, NOT] rhs = 1 + offset; C.a_mode_meas = rhs; // c_side.test_pat[real, 0, NOT] rhs = 2 + offset; C.a_mode_ref = rhs; // c_side.test_pat[real, 0, NOT] rhs = 3 + offset; C.b_mode_meas = rhs; // c_side.test_pat[real, 0, NOT] rhs = 4 + offset; C.b_mode_ref = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_ping_scale (Opaque_tao_ping_scale_class* F, bool& c_ok) { CPP_tao_ping_scale C, C2; c_ok = true; tao_ping_scale_to_c (F, C); set_CPP_tao_ping_scale_test_pattern (C2, 1); if (C == C2) { cout << " tao_ping_scale: C side convert F->C: Good" << endl; } else { cout << " tao_ping_scale: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_ping_scale_test_pattern (C2, 2); bool c_ok2; test2_f_tao_ping_scale (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_ping_scale_test_pattern (C, 3); if (C == C2) { cout << " tao_ping_scale: F side convert F->C: Good" << endl; } else { cout << " tao_ping_scale: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_ping_scale_test_pattern (C2, 4); tao_ping_scale_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_universe_branch (CPP_tao_universe_branch&, bool&); void set_CPP_tao_universe_branch_test_pattern (CPP_tao_universe_branch& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.ele.resize(0); else { C.ele.resize(3); for (unsigned int i = 0; i < C.ele.size(); i++) {set_CPP_tao_element_test_pattern(C.ele[i], ix_patt+i+1);} } // c_side.test_pat[character, 0, NOT] C.track_start.resize(40); for (unsigned int i = 0; i < C.track_start.size(); i++) {int rhs = 101 + i + 3 + offset; C.track_start[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.track_end.resize(40); for (unsigned int i = 0; i < C.track_end.size(); i++) {int rhs = 101 + i + 4 + offset; C.track_end[i] = 'a' + rhs % 26;} // c_side.test_pat[integer, 0, NOT] rhs = 5 + offset; C.ix_track_start = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 6 + offset; C.ix_track_end = rhs; } //-------------------------------------------------------------- extern "C" void test_c_tao_universe_branch (Opaque_tao_universe_branch_class* F, bool& c_ok) { CPP_tao_universe_branch C, C2; c_ok = true; tao_universe_branch_to_c (F, C); set_CPP_tao_universe_branch_test_pattern (C2, 1); if (C == C2) { cout << " tao_universe_branch: C side convert F->C: Good" << endl; } else { cout << " tao_universe_branch: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_universe_branch_test_pattern (C2, 2); bool c_ok2; test2_f_tao_universe_branch (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_universe_branch_test_pattern (C, 3); if (C == C2) { cout << " tao_universe_branch: F side convert F->C: Good" << endl; } else { cout << " tao_universe_branch: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_universe_branch_test_pattern (C2, 4); tao_universe_branch_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_beam (CPP_tao_beam&, bool&); void set_CPP_tao_beam_test_pattern (CPP_tao_beam& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 0, NOT] set_CPP_beam_init_test_pattern(C.beam_init, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_beam_test_pattern(C.start, ix_patt); // c_side.test_pat[logical, 0, NOT] rhs = 3 + offset; C.init_beam0 = (rhs % 2 == 0); // c_side.test_pat[character, 0, NOT] C.beam_all_file.resize(80); for (unsigned int i = 0; i < C.beam_all_file.size(); i++) {int rhs = 101 + i + 4 + offset; C.beam_all_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.beam0_file.resize(80); for (unsigned int i = 0; i < C.beam0_file.size(); i++) {int rhs = 101 + i + 5 + offset; C.beam0_file[i] = 'a' + rhs % 26;} // c_side.test_pat[character, 0, NOT] C.saved_at.resize(160); for (unsigned int i = 0; i < C.saved_at.size(); i++) {int rhs = 101 + i + 6 + offset; C.saved_at[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_tao_beam (Opaque_tao_beam_class* F, bool& c_ok) { CPP_tao_beam C, C2; c_ok = true; tao_beam_to_c (F, C); set_CPP_tao_beam_test_pattern (C2, 1); if (C == C2) { cout << " tao_beam: C side convert F->C: Good" << endl; } else { cout << " tao_beam: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_beam_test_pattern (C2, 2); bool c_ok2; test2_f_tao_beam (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_beam_test_pattern (C, 3); if (C == C2) { cout << " tao_beam: F side convert F->C: Good" << endl; } else { cout << " tao_beam: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_beam_test_pattern (C2, 4); tao_beam_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_universe_calc (CPP_tao_universe_calc&, bool&); void set_CPP_tao_universe_calc_test_pattern (CPP_tao_universe_calc& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[logical, 0, NOT] rhs = 1 + offset; C.rad_int_for_data = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 2 + offset; C.rad_int_for_plotting = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 3 + offset; C.chrom_for_data = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 4 + offset; C.chrom_for_plotting = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 5 + offset; C.beam_sigma_for_data = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 6 + offset; C.beam_sigma_for_plotting = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 7 + offset; C.dynamic_aperture = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 8 + offset; C.one_turn_map = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 9 + offset; C.lattice = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 10 + offset; C.mat6 = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 11 + offset; C.track = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_universe_calc (Opaque_tao_universe_calc_class* F, bool& c_ok) { CPP_tao_universe_calc C, C2; c_ok = true; tao_universe_calc_to_c (F, C); set_CPP_tao_universe_calc_test_pattern (C2, 1); if (C == C2) { cout << " tao_universe_calc: C side convert F->C: Good" << endl; } else { cout << " tao_universe_calc: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_universe_calc_test_pattern (C2, 2); bool c_ok2; test2_f_tao_universe_calc (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_universe_calc_test_pattern (C, 3); if (C == C2) { cout << " tao_universe_calc: F side convert F->C: Good" << endl; } else { cout << " tao_universe_calc: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_universe_calc_test_pattern (C2, 4); tao_universe_calc_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_mpi (CPP_tao_mpi&, bool&); void set_CPP_tao_mpi_test_pattern (CPP_tao_mpi& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[logical, 0, NOT] rhs = 1 + offset; C.on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 2 + offset; C.master = (rhs % 2 == 0); // c_side.test_pat[integer, 0, NOT] rhs = 3 + offset; C.rank = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 4 + offset; C.max_rank = rhs; // c_side.test_pat[character, 0, NOT] C.host_name.resize(160); for (unsigned int i = 0; i < C.host_name.size(); i++) {int rhs = 101 + i + 5 + offset; C.host_name[i] = 'a' + rhs % 26;} } //-------------------------------------------------------------- extern "C" void test_c_tao_mpi (Opaque_tao_mpi_class* F, bool& c_ok) { CPP_tao_mpi C, C2; c_ok = true; tao_mpi_to_c (F, C); set_CPP_tao_mpi_test_pattern (C2, 1); if (C == C2) { cout << " tao_mpi: C side convert F->C: Good" << endl; } else { cout << " tao_mpi: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_mpi_test_pattern (C2, 2); bool c_ok2; test2_f_tao_mpi (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_mpi_test_pattern (C, 3); if (C == C2) { cout << " tao_mpi: F side convert F->C: Good" << endl; } else { cout << " tao_mpi: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_mpi_test_pattern (C2, 4); tao_mpi_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_dynamic_aperture (CPP_tao_dynamic_aperture&, bool&); void set_CPP_tao_dynamic_aperture_test_pattern (CPP_tao_dynamic_aperture& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.scan.resize(0); else { C.scan.resize(3); for (unsigned int i = 0; i < C.scan.size(); i++) {set_CPP_aperture_scan_test_pattern(C.scan[i], ix_patt+i+1);} } // c_side.test_pat[real, 1, ALLOC] if (ix_patt < 3) C.pz.resize(0); else { C.pz.resize(3); for (unsigned int i = 0; i < C.pz.size(); i++) {int rhs = 101 + i + 3 + offset; C.pz[i] = rhs;} } } //-------------------------------------------------------------- extern "C" void test_c_tao_dynamic_aperture (Opaque_tao_dynamic_aperture_class* F, bool& c_ok) { CPP_tao_dynamic_aperture C, C2; c_ok = true; tao_dynamic_aperture_to_c (F, C); set_CPP_tao_dynamic_aperture_test_pattern (C2, 1); if (C == C2) { cout << " tao_dynamic_aperture: C side convert F->C: Good" << endl; } else { cout << " tao_dynamic_aperture: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_dynamic_aperture_test_pattern (C2, 2); bool c_ok2; test2_f_tao_dynamic_aperture (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_dynamic_aperture_test_pattern (C, 3); if (C == C2) { cout << " tao_dynamic_aperture: F side convert F->C: Good" << endl; } else { cout << " tao_dynamic_aperture: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_dynamic_aperture_test_pattern (C2, 4); tao_dynamic_aperture_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_universe (CPP_tao_universe&, bool&); void set_CPP_tao_universe_test_pattern (CPP_tao_universe& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 0, NOT] set_CPP_tao_beam_test_pattern(C.beam, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_dynamic_aperture_test_pattern(C.dynamic_aperture, ix_patt); // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.d2_data.resize(0); else { C.d2_data.resize(3); for (unsigned int i = 0; i < C.d2_data.size(); i++) {set_CPP_tao_d2_data_test_pattern(C.d2_data[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.data.resize(0); else { C.data.resize(3); for (unsigned int i = 0; i < C.data.size(); i++) {set_CPP_tao_data_test_pattern(C.data[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_tao_ping_scale_test_pattern(C.ping_scale, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_lat_test_pattern(C.scratch_lat, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_universe_calc_test_pattern(C.calc, ix_patt); // c_side.test_pat[real, 2, ALLOC] if (ix_patt < 3) C.dmodel_dvar.resize(0); else { C.dmodel_dvar.resize(3); for (unsigned int i = 0; i < C.dmodel_dvar.size(); i++) C.dmodel_dvar[i].resize(2); for (unsigned int i = 0; i < C.dmodel_dvar.size(); i++) for (unsigned int j = 0; j < C.dmodel_dvar[0].size(); j++) {int rhs = 101 + i + 10*(j+1) + 20 + offset; C.dmodel_dvar[i][j] = rhs;} } // c_side.test_pat[integer, 0, NOT] rhs = 23 + offset; C.ix_uni = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 24 + offset; C.n_d2_data_used = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 25 + offset; C.n_data_used = rhs; // c_side.test_pat[logical, 0, NOT] rhs = 26 + offset; C.reverse_tracking = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 27 + offset; C.is_on = (rhs % 2 == 0); // c_side.test_pat[logical, 0, NOT] rhs = 28 + offset; C.picked_uni = (rhs % 2 == 0); } //-------------------------------------------------------------- extern "C" void test_c_tao_universe (Opaque_tao_universe_class* F, bool& c_ok) { CPP_tao_universe C, C2; c_ok = true; tao_universe_to_c (F, C); set_CPP_tao_universe_test_pattern (C2, 1); if (C == C2) { cout << " tao_universe: C side convert F->C: Good" << endl; } else { cout << " tao_universe: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_universe_test_pattern (C2, 2); bool c_ok2; test2_f_tao_universe (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_universe_test_pattern (C, 3); if (C == C2) { cout << " tao_universe: F side convert F->C: Good" << endl; } else { cout << " tao_universe: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_universe_test_pattern (C2, 4); tao_universe_to_f (C2, F); } //-------------------------------------------------------------- //-------------------------------------------------------------- extern "C" void test2_f_tao_super_universe (CPP_tao_super_universe&, bool&); void set_CPP_tao_super_universe_test_pattern (CPP_tao_super_universe& C, int ix_patt) { int rhs, offset = 100 * ix_patt; // c_side.test_pat[type, 0, NOT] set_CPP_tao_global_test_pattern(C.global, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_common_test_pattern(C.com, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_plot_page_test_pattern(C.plot_page, ix_patt); // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.v1_var.resize(0); else { C.v1_var.resize(3); for (unsigned int i = 0; i < C.v1_var.size(); i++) {set_CPP_tao_v1_var_test_pattern(C.v1_var[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.var.resize(0); else { C.var.resize(3); for (unsigned int i = 0; i < C.var.size(); i++) {set_CPP_tao_var_test_pattern(C.var[i], ix_patt+i+1);} } // c_side.test_pat[type, 1, ALLOC] if (ix_patt < 3) C.u.resize(0); else { C.u.resize(3); for (unsigned int i = 0; i < C.u.size(); i++) {set_CPP_tao_universe_test_pattern(C.u[i], ix_patt+i+1);} } // c_side.test_pat[type, 0, NOT] set_CPP_tao_mpi_test_pattern(C.mpi, ix_patt); // c_side.test_pat[integer, 1, ALLOC] if (ix_patt < 3) C.key.resize(0); else { C.key.resize(3); for (unsigned int i = 0; i < C.key.size(); i++) {int rhs = 101 + i + 11 + offset; C.key[i] = rhs;} } // c_side.test_pat[type, 0, NOT] set_CPP_tao_building_wall_test_pattern(C.building_wall, ix_patt); // c_side.test_pat[type, 0, NOT] set_CPP_tao_wave_test_pattern(C.wave, ix_patt); // c_side.test_pat[integer, 0, NOT] rhs = 15 + offset; C.n_var_used = rhs; // c_side.test_pat[integer, 0, NOT] rhs = 16 + offset; C.n_v1_var_used = rhs; // c_side.test_pat[type, 1, NOT] for (unsigned int i = 0; i < C.history.size(); i++) {int rhs = 101 + i + 17 + offset; set_CPP_tao_cmd_history_test_pattern(C.history[i], ix_patt+i+1);} } //-------------------------------------------------------------- extern "C" void test_c_tao_super_universe (Opaque_tao_super_universe_class* F, bool& c_ok) { CPP_tao_super_universe C, C2; c_ok = true; tao_super_universe_to_c (F, C); set_CPP_tao_super_universe_test_pattern (C2, 1); if (C == C2) { cout << " tao_super_universe: C side convert F->C: Good" << endl; } else { cout << " tao_super_universe: C SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_super_universe_test_pattern (C2, 2); bool c_ok2; test2_f_tao_super_universe (C2, c_ok2); if (!c_ok2) c_ok = false; set_CPP_tao_super_universe_test_pattern (C, 3); if (C == C2) { cout << " tao_super_universe: F side convert F->C: Good" << endl; } else { cout << " tao_super_universe: F SIDE CONVERT F->C: FAILED!" << endl; c_ok = false; } set_CPP_tao_super_universe_test_pattern (C2, 4); tao_super_universe_to_f (C2, F); }