static int test_check_boot_esc(void) { TEST_CHECK(keyboard_scan_get_boot_keys() == BOOT_KEY_ESC); }
int main() { TEST_SET_START("20040920095218EJL","EJL", "recipd2"); unsigned long long i6 = 0x7fd0000000000001ull; // 2^1022 + 1 ulp unsigned long long i7 = 0xffd0000000000000ull; // -2^1022 unsigned long long i7r = 0x8010000000000000ull; // -2^-1022 unsigned long long i8 = 0x7606a4533cf5605eull; // random values unsigned long long i8r = 0x09d69cea2b5b5b57ull; unsigned long long i9 = 0x4c042c295376566eull; unsigned long long i9r = 0x33d9618e87b961f4ull; unsigned long long i10 = 0x39b3720562510408ull; unsigned long long i10r = 0x462a54842d7f9b5dull; unsigned long long i11 = 0x6911a64538a389aeull; unsigned long long i11r = 0x16cd02637ed13ff2ull; unsigned long long i12 = 0x1ac4d062d451c99dull; unsigned long long i12r = 0x6518994c26ebbb3eull; double x0 = hide_double(-HUGE_VAL); // -Inf double x1 = hide_double(HUGE_VAL); // Inf double x2 = hide_double(0.0); // 0 double x3 = hide_double(-0.0); // -0 double x4 = hide_double(nan("")); // NaN double x5 = hide_double(2.0); double x5r = hide_double(0.5); double x6 = hide_double(make_double(i6)); double x7 = hide_double(make_double(i7)); double x7r = hide_double(make_double(i7r)); double x8 = hide_double(make_double(i8)); double x8r = hide_double(make_double(i8r)); double x9 = hide_double(make_double(i9)); double x9r = hide_double(make_double(i9r)); double x10 = hide_double(make_double(i10)); double x10r = hide_double(make_double(i10r)); double x11 = hide_double(make_double(i11)); double x11r = hide_double(make_double(i11r)); double x12 = hide_double(make_double(i12)); double x12r = hide_double(make_double(i12r)); vec_double2 x0_v = spu_splats(x0); vec_double2 x1_v = spu_splats(x1); vec_double2 x2_v = spu_splats(x2); vec_double2 x3_v = spu_splats(x3); vec_double2 x4_v = spu_splats(x4); vec_double2 x5_v = spu_splats(x5); vec_double2 x5r_v = spu_splats(x5r); vec_double2 x6_v = spu_splats(x6); vec_double2 x7_v = spu_splats(x7); vec_double2 x7r_v = spu_splats(x7r); vec_double2 x8_v = spu_splats(x8); vec_double2 x8r_v = spu_splats(x8r); vec_double2 x9_v = spu_splats(x9); vec_double2 x9r_v = spu_splats(x9r); vec_double2 x10_v = spu_splats(x10); vec_double2 x10r_v = spu_splats(x10r); vec_double2 x11_v = spu_splats(x11); vec_double2 x11r_v = spu_splats(x11r); vec_double2 x12_v = spu_splats(x12); vec_double2 x12r_v = spu_splats(x12r); vec_double2 res_v; TEST_START("recipd2"); res_v = recipd2(x0_v); TEST_CHECK("20040920095224EJL", allnegzero_double2( res_v ), 0); res_v = recipd2(x1_v); TEST_CHECK("20040920095226EJL", allposzero_double2( res_v ), 0); res_v = recipd2(x2_v); TEST_CHECK("20040920095228EJL", allposinf_double2( res_v ), 0); res_v = recipd2(x3_v); TEST_CHECK("20040920095233EJL", allneginf_double2( res_v ), 0); res_v = recipd2(x4_v); TEST_CHECK("20040920095235EJL", allnan_double2( res_v ), 0); res_v = recipd2(x5_v); TEST_CHECK("20040920095237EJL", allequal_double2( res_v, x5r_v ), 0); res_v = recipd2(x6_v); TEST_CHECK("20040920095239EJL", allzerodenorm_double2( res_v ), 0); res_v = recipd2(x7_v); TEST_CHECK("20040920095242EJL", allequal_double2( res_v, x7r_v ), 0); res_v = recipd2(x8_v); TEST_CHECK("20040920095245EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0); res_v = recipd2(x9_v); TEST_CHECK("20040920095247EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0); res_v = recipd2(x10_v); TEST_CHECK("20040920095248EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0); res_v = recipd2(x11_v); TEST_CHECK("20040920095250EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0); res_v = recipd2(x12_v); TEST_CHECK("20040920095252EJL", allequal_ulps_double2( res_v, x12r_v, 1 ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20040928105926EJL","EJL", "divf4"); unsigned int i0n = 0x75013340; unsigned int i0d = 0x75e7753f; unsigned int i0r = 0x3e8ee64b; unsigned int i1n = 0x4c7fed5a; unsigned int i1d = 0x3a0731f0; unsigned int i1r = 0x51f24e86; unsigned int i2n = 0x5b08b303; unsigned int i2d = 0x562f5046; unsigned int i2r = 0x44479d24; unsigned int i3n = 0x748a9b87; unsigned int i3d = 0x6b014b46; unsigned int i3r = 0x49093864; unsigned int i4n = 0x35dcf9d8; unsigned int i4d = 0x6278d6e0; unsigned int i4r = 0x12e355b5; unsigned int i5n = 0x74d505fd; unsigned int i5d = 0x61ef565e; unsigned int i5r = 0x5263daa3; float x0n = hide_float(make_float(i0n)); float x0d = hide_float(make_float(i0d)); float x0r = hide_float(make_float(i0r)); float x1n = hide_float(make_float(i1n)); float x1d = hide_float(make_float(i1d)); float x1r = hide_float(make_float(i1r)); float x2n = hide_float(make_float(i2n)); float x2d = hide_float(make_float(i2d)); float x2r = hide_float(make_float(i2r)); float x3n = hide_float(make_float(i3n)); float x3d = hide_float(make_float(i3d)); float x3r = hide_float(make_float(i3r)); float x4n = hide_float(make_float(i4n)); float x4d = hide_float(make_float(i4d)); float x4r = hide_float(make_float(i4r)); float x5n = hide_float(make_float(i5n)); float x5d = hide_float(make_float(i5d)); float x5r = hide_float(make_float(i5r)); vec_float4 x0n_v = spu_splats(x0n); vec_float4 x0d_v = spu_splats(x0d); vec_float4 x0r_v = spu_splats(x0r); vec_float4 x1n_v = spu_splats(x1n); vec_float4 x1d_v = spu_splats(x1d); vec_float4 x1r_v = spu_splats(x1r); vec_float4 x2n_v = spu_splats(x2n); vec_float4 x2d_v = spu_splats(x2d); vec_float4 x2r_v = spu_splats(x2r); vec_float4 x3n_v = spu_splats(x3n); vec_float4 x3d_v = spu_splats(x3d); vec_float4 x3r_v = spu_splats(x3r); vec_float4 x4n_v = spu_splats(x4n); vec_float4 x4d_v = spu_splats(x4d); vec_float4 x4r_v = spu_splats(x4r); vec_float4 x5n_v = spu_splats(x5n); vec_float4 x5d_v = spu_splats(x5d); vec_float4 x5r_v = spu_splats(x5r); vec_float4 res_v; TEST_START("divf4"); res_v = divf4(x0n_v, x0d_v); TEST_CHECK("20040928105932EJL", allequal_ulps_float4( res_v, x0r_v, 2 ), 0); res_v = divf4(x1n_v, x1d_v); TEST_CHECK("20040928105934EJL", allequal_ulps_float4( res_v, x1r_v, 2 ), 0); res_v = divf4(x2n_v, x2d_v); TEST_CHECK("20040928105936EJL", allequal_ulps_float4( res_v, x2r_v, 2 ), 0); res_v = divf4(x3n_v, x3d_v); TEST_CHECK("20040928105938EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0); res_v = divf4(x4n_v, x4d_v); TEST_CHECK("20040928105940EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0); res_v = divf4(x5n_v, x5d_v); TEST_CHECK("20040928105943EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20060828114000MH","MH", "fmad2"); // double denorm_min = hide_double(make_double(0x0000000000000001ull)); double denorm_max = hide_double(make_double(0x000fffffffffffffull)); // double norm_min = hide_double(make_double(0x0010000000000000ull)); double norm_max = hide_double(make_double(0x7fefffffffffffffull)); double x0 = hide_double(1760.135); double y0 = hide_double(19355.03); double z0 = hide_double(-12351.9); double a0 = hide_double(34055113.82905); double x1 = hide_double(-139.035); double y1 = hide_double(0.0); double z1 = hide_double(-1.0); double x2 = hide_double(nan("")); double y2 = hide_double(-1.0); double z2 = hide_double(-0.0); double x3 = hide_double(1.0); double y3 = hide_double(HUGE_VAL); double z3 = hide_double(-1.0); double x4 = norm_max; double y4 = norm_max; double z4 = hide_double(0.0); double x5 = hide_double(100.0); double y5 = denorm_max; double z5 = hide_double(0.0); double a5 = hide_double(make_double(0x0078fffffffffffeull)); vec_double2 x0_v = spu_splats(x0); vec_double2 y0_v = spu_splats(y0); vec_double2 z0_v = spu_splats(z0); vec_double2 x1_v = spu_splats(x1); vec_double2 y1_v = spu_splats(y1); vec_double2 z1_v = spu_splats(z1); vec_double2 x2_v = spu_splats(x2); vec_double2 y2_v = spu_splats(y2); vec_double2 z2_v = spu_splats(z2); vec_double2 x3_v = spu_splats(x3); vec_double2 y3_v = spu_splats(y3); vec_double2 z3_v = spu_splats(z3); vec_double2 x4_v = spu_splats(x4); vec_double2 y4_v = spu_splats(y4); vec_double2 z4_v = spu_splats(z4); vec_double2 x5_v = spu_splats(x5); vec_double2 y5_v = spu_splats(y5); vec_double2 z5_v = spu_splats(z5); vec_double2 a0_v = spu_splats(a0); vec_double2 a1_v = spu_splats(z1); vec_double2 a5_v = spu_splats(a5); vec_double2 res_v; TEST_START("fmad2"); res_v = fmad2(x0_v, y0_v, z0_v); TEST_CHECK("20060828114001MH", allequal_ulps_double2( res_v, a0_v, 1 ), 0); res_v = fmad2(y0_v, x0_v, z0_v); TEST_CHECK("20060828114002MH", allequal_ulps_double2( res_v, a0_v, 1 ), 0); res_v = fmad2(x1_v, y1_v, z1_v); TEST_CHECK("20060828114003MH", allequal_ulps_double2( res_v, a1_v, 1 ), 0); res_v = fmad2(y1_v, x1_v, z1_v); TEST_CHECK("20060828114004MH", allequal_ulps_double2( res_v, a1_v, 1 ), 0); res_v = fmad2(x2_v, y2_v, z2_v); TEST_CHECK("20060828114005MH", allnan_double2( res_v ), 0); res_v = fmad2(y2_v, x2_v, z2_v); TEST_CHECK("20060828114006MH", allnan_double2( res_v ), 0); res_v = fmad2(x3_v, y3_v, z3_v); TEST_CHECK("20060828114007MH", allposinf_double2( res_v ), 0); res_v = fmad2(y3_v, x3_v, z3_v); TEST_CHECK("20060828114008MH", allposinf_double2( res_v ), 0); res_v = fmad2(x4_v, y4_v, z4_v); TEST_CHECK("20060828114009MH", allposinf_double2( res_v ), 0); res_v = fmad2(y4_v, x4_v, z4_v); TEST_CHECK("20060828114010MH", allposinf_double2( res_v ), 0); res_v = fmad2(x5_v, y5_v, z5_v); TEST_CHECK("20060828114011MH", allequal_ulps_double2( res_v, a5_v, 1 ), 0); res_v = fmad2(y5_v, x5_v, z5_v); TEST_CHECK("20060828114012MH", allequal_ulps_double2( res_v, a5_v, 1 ), 0); //printf("res:%.10le, a5:%.10le\n", spu_extract(res_v, 0), spu_extract(a5_v, 0)); TEST_SET_DONE(); TEST_EXIT(); }
::DDS::ReturnCode_t write (int writer_id, ACE_Atomic_Op<ACE_SYNCH_MUTEX, int> & timeout_writes, ::DDS::DataWriter_ptr writer) { try { DT foo; //foo.data_source set below. foo.x = -1; foo.y = (float)writer_id; // Use the thread id as the instance key. foo.data_source = ++key; DW_var foo_dw = DW::_narrow(writer); TEST_CHECK (! CORBA::is_nil (foo_dw.in ())); ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) %T Writer::svc starting to write.\n"))); ::DDS::InstanceHandle_t handle = foo_dw->register_instance(foo); for (int i = 0; i< num_samples_per_instance; i ++) { ACE_DEBUG ((LM_INFO, ACE_TEXT("(%P|%t) write (%d).\n"), i)); foo.x = (float)i; foo.values.length (sequence_length); for (int j = 0; j < sequence_length; j ++) { foo.values[j] = (float) (i * i - j); } ::DDS::ReturnCode_t ret = foo_dw->write(foo, handle); if (ret != ::DDS::RETCODE_OK) { if (::OpenDDS::DCPS::DCPS_debug_level > 0 && ret != ::DDS::RETCODE_TIMEOUT) { ACE_ERROR ((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: Writer::svc, ") ACE_TEXT ("%dth write() returned %d.\n"), i, ret)); } if (ret == ::DDS::RETCODE_TIMEOUT) { if (::OpenDDS::DCPS::DCPS_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) NOTE: Writer::svc, ") ACE_TEXT ("%dth write() returned %d (RETCODE_TIMEOUT).\n"), i, ret)); } timeout_writes ++; } } if (op_interval_ms) { // Delay between sends to avoid dropping. static ACE_Time_Value delay(op_interval_ms/1000, op_interval_ms%1000 *1000); ACE_OS::sleep (delay); } } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught in svc:"); } return ::DDS::RETCODE_OK; }
int main(int argc, char** argv) { TEST_CHECK(testConvexHull); return 0; }
void lua_state::check() const { TEST_CHECK(lua_gettop(m_state) == m_top); }
void PubDriver::init(int& argc, char *argv[]) { // Create DomainParticipant and then publisher, topic and datawriter. ::DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv); // Activate the PubDriver servant and write its ior to a file. PortableServer::POA_var poa = TheServiceParticipant->the_poa (); CORBA::ORB_var orb = TheServiceParticipant->get_ORB (); PortableServer::ObjectId_var id = poa->activate_object(this); CORBA::Object_var object = poa->id_to_reference(id.in()); CORBA::String_var ior_string = orb->object_to_string (object.in ()); // // Write the IOR to a file. // FILE *output_file= ACE_OS::fopen (pub_driver_ior_.c_str (), "w"); if (output_file == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT("Cannot open output file for writing IOR\n"))); } ACE_OS::fprintf (output_file, "%s", ior_string.in ()); ACE_OS::fclose (output_file); datawriters_ = new ::DDS::DataWriter_var[num_datawriters_]; writers_ = new Writer* [num_datawriters_]; ::Mine::FooTypeSupportImpl* fts_servant = new ::Mine::FooTypeSupportImpl(); PortableServer::ServantBase_var safe_servant = fts_servant; ::Mine::FooTypeSupport_var fts = ::TAO::DCPS::servant_to_reference (fts_servant); participant_ = dpf->create_participant(MY_DOMAIN, PARTICIPANT_QOS_DEFAULT, ::DDS::DomainParticipantListener::_nil()); TEST_CHECK (! CORBA::is_nil (participant_.in ())); if (::DDS::RETCODE_OK != fts->register_type(participant_.in (), MY_TYPE)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed to register the FooTypeSupport."))); } ::DDS::TopicQos topic_qos; participant_->get_default_topic_qos(topic_qos); if (block_on_write_) { topic_qos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS; topic_qos.resource_limits.max_samples_per_instance = max_samples_per_instance_; topic_qos.history.kind = ::DDS::KEEP_ALL_HISTORY_QOS; } else { topic_qos.history.depth = history_depth_; } topic_ = participant_->create_topic (MY_TOPIC, MY_TYPE, topic_qos, ::DDS::TopicListener::_nil()); TEST_CHECK (! CORBA::is_nil (topic_.in ())); publisher_ = participant_->create_publisher(PUBLISHER_QOS_DEFAULT, ::DDS::PublisherListener::_nil()); TEST_CHECK (! CORBA::is_nil (publisher_.in ())); attach_to_transport (); ::DDS::DataWriterQos datawriter_qos; publisher_->get_default_datawriter_qos (datawriter_qos); if (block_on_write_) { datawriter_qos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS; datawriter_qos.resource_limits.max_samples_per_instance = max_samples_per_instance_; datawriter_qos.history.kind = ::DDS::KEEP_ALL_HISTORY_QOS; } else { datawriter_qos.history.depth = history_depth_; } // Create one datawriter or multiple datawriters belong to the same // publisher. for (int i = 0; i < num_datawriters_; i ++) { datawriters_[i] = publisher_->create_datawriter(topic_.in (), datawriter_qos, ::DDS::DataWriterListener::_nil()); TEST_CHECK (! CORBA::is_nil (datawriters_[i].in ())); } }
void test_set_1(void) { /* * Inputs */ uint8_t ki[] = { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f, 0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc }; uint8_t rand[] = { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d, 0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 }; uint8_t sqn[] = { 0xff, 0x9b, 0xb4, 0xd0, 0xb6, 0x07 }; uint8_t amf[] = { 0xb9, 0xb9 }; uint8_t op[] = { 0xcd, 0xc2, 0x02, 0xd5, 0x12, 0x3e, 0x20, 0xf6, 0x2b, 0x6d, 0x67, 0x6a, 0xc7, 0x2c, 0xb3, 0x18 }; uint8_t opc[] = { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e, 0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf }; /* * Outputs */ uint8_t opc_out[MILENAGE_OPC_SIZE]; uint8_t mac_a_out[MILENAGE_MAC_A_SIZE]; uint8_t mac_s_out[MILENAGE_MAC_S_SIZE]; uint8_t res_out[MILENAGE_RES_SIZE]; uint8_t ck_out[MILENAGE_CK_SIZE]; uint8_t ik_out[MILENAGE_IK_SIZE]; uint8_t ak_out[MILENAGE_AK_SIZE]; uint8_t ak_resync_out[MILENAGE_AK_SIZE]; /* function 1 */ uint8_t mac_a[] = { 0x4a, 0x9f, 0xfa, 0xc3, 0x54, 0xdf, 0xaf, 0xb3 }; /* function 1* */ uint8_t mac_s[] = { 0x01, 0xcf, 0xaf, 0x9e, 0xc4, 0xe8, 0x71, 0xe9 }; /* function 2 */ uint8_t res[] = { 0xa5, 0x42, 0x11, 0xd5, 0xe3, 0xba, 0x50, 0xbf }; /* function 3 */ uint8_t ck[] = { 0xb4, 0x0b, 0xa9, 0xa3, 0xc5, 0x8b, 0x2a, 0x05, 0xbb, 0xf0, 0xd9, 0x87, 0xb2, 0x1b, 0xf8, 0xcb }; /* function 4 */ uint8_t ik[] = { 0xf7, 0x69, 0xbc, 0xd7, 0x51, 0x04, 0x46, 0x04, 0x12, 0x76, 0x72, 0x71, 0x1c, 0x6d, 0x34, 0x41 }; /* function 5 */ uint8_t ak[] = { 0xaa, 0x68, 0x9c, 0x64, 0x83, 0x70 }; /* function 5* */ uint8_t ak_resync[] = { 0x45, 0x1e, 0x8b, 0xec, 0xa4, 0x3b }; int ret = 0; /* fr_log_fp = stdout; fr_debug_lvl = 4; */ ret = milenage_opc_generate(opc_out, op, ki); TEST_CHECK(ret == 0); FR_PROTO_HEX_DUMP(opc_out, sizeof(opc_out), "opc"); TEST_CHECK(memcmp(opc_out, opc, sizeof(opc_out)) == 0); if ((milenage_f1(mac_a_out, mac_s_out, opc, ki, rand, sqn, amf) < 0) || (milenage_f2345(res_out, ik_out, ck_out, ak_out, ak_resync_out, opc, ki, rand) < 0)) ret = -1; FR_PROTO_HEX_DUMP(mac_a, sizeof(mac_a_out), "mac_a"); FR_PROTO_HEX_DUMP(mac_s, sizeof(mac_s_out), "mac_s"); FR_PROTO_HEX_DUMP(ik_out, sizeof(ik_out), "ik"); FR_PROTO_HEX_DUMP(ck_out, sizeof(ck_out), "ck"); FR_PROTO_HEX_DUMP(res_out, sizeof(res_out), "res"); FR_PROTO_HEX_DUMP(ak_out, sizeof(ak_out), "ak"); FR_PROTO_HEX_DUMP(ak_resync_out, sizeof(ak_resync_out), "ak_resync"); TEST_CHECK(ret == 0); TEST_CHECK(memcmp(mac_a_out, mac_a, sizeof(mac_a_out)) == 0); TEST_CHECK(memcmp(mac_s_out, mac_s, sizeof(mac_s_out)) == 0); TEST_CHECK(memcmp(res_out, res, sizeof(res_out)) == 0); TEST_CHECK(memcmp(ck_out, ck, sizeof(ck_out)) == 0); TEST_CHECK(memcmp(ik_out, ik, sizeof(ik_out)) == 0); TEST_CHECK(memcmp(ak_out, ak, sizeof(ak_out)) == 0); TEST_CHECK(memcmp(ak_resync, ak_resync, sizeof(ak_resync_out)) == 0); }
int main(int, char**) { TEST_CHECK(EnumConstructor); TEST_CHECK(ToType); TEST_CHECK(SixToString); }
int main() { TestVec64_Ldexp test_a[] = { { // zero {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000400ULL,0xFFFFFFFFFFFFFC00ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL} },{ // MIN , MAX {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}, {0x0000000000000001ULL,0x0000000000000001ULL}, {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}, {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}, {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}, {0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL} },{ // Inf , -Inf {0x7FF0000000000000ULL,0xFFF0000000000000ULL}, {0x0000000000000001ULL,0x0000000000000001ULL}, {0x7FF0000000000000ULL,0xFFF0000000000000ULL}, {0x7FF0000000000000ULL,0xFFF0000000000000ULL}, {0x7FF0000000000000ULL,0xFFF0000000000000ULL}, {0x7FF0000000000000ULL,0xFFF0000000000000ULL} },{ #ifdef LDEXPD2_ROUND // denotmalized {0x8000000000000003ULL,0x0000000000000003ULL}, {0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x8000000000000002ULL,0x0000000000000001ULL}, {0x8000000000000001ULL,0x0000000000000002ULL}, {0x8000000000000001ULL,0x0000000000000001ULL}, {0x8000000000000002ULL,0x0000000000000002ULL} },{ // denotmalized -54 {0x0010000000000001ULL,0x8010000000000001ULL}, {0xFFFFFFFFFFFFFFCAULL,0xFFFFFFFFFFFFFFCAULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000001ULL,0x8000000000000001ULL}, {0x0000000000000000ULL,0x8000000000000000ULL} },{ // max -> ! {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0xFFFFFFFFFFFFF7CEULL,0xFFFFFFFFFFFFF7CEULL}, {0x0000000000000001ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000001ULL,0x8000000000000001ULL}, {0x0000000000000000ULL,0x8000000000000001ULL} },{ // max -> ! {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0xFFFFFFFFFFFFF7CDULL,0xFFFFFFFFFFFFF7CDULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000001ULL,0x8000000000000001ULL}, {0x0000000000000000ULL,0x8000000000000000ULL} },{ #else // LDEXPD2_ROUND // denotmalized {0x8000000000000003ULL,0x0000000000000003ULL}, {0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x8000000000000001ULL,0x0000000000000001ULL}, {0x8000000000000001ULL,0x0000000000000001ULL}, {0x8000000000000001ULL,0x0000000000000001ULL}, {0x8000000000000001ULL,0x0000000000000001ULL} },{ #endif // LDEXPD2_ROUND // denotmalized {0x0010000000000000ULL,0x8010000000000000ULL}, {0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x0008000000000000ULL,0x8008000000000000ULL}, {0x0008000000000000ULL,0x8008000000000000ULL}, {0x0008000000000000ULL,0x8008000000000000ULL}, {0x0008000000000000ULL,0x8008000000000000ULL} },{ // denotmalized {0x0008000000000000ULL,0x8008000000000000ULL}, {0x0000000000000001ULL,0x0000000000000001ULL}, {0x0010000000000000ULL,0x8010000000000000ULL}, {0x0010000000000000ULL,0x8010000000000000ULL}, {0x0010000000000000ULL,0x8010000000000000ULL}, {0x0010000000000000ULL,0x8010000000000000ULL} },{ // 1.0 {0x3ff0000000000000ULL,0xbff0000000000000ULL}, {0x00000000000003ffULL,0x00000000000003ffULL}, {0x7FE0000000000000ULL,0xFFE0000000000000ULL}, {0x7FE0000000000000ULL,0xFFE0000000000000ULL}, {0x7FE0000000000000ULL,0xFFE0000000000000ULL}, {0x7FE0000000000000ULL,0xFFE0000000000000ULL} },{ // 1.0 -> max {0x3ff0000000000000ULL,0xbff0000000000000ULL}, {0x0000000000000400ULL,0x0000000000000400ULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL} },{ // max -> ! {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0xFFFFFFFF00000000ULL,0xFFFFFFFF00000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL}, {0x0000000000000000ULL,0x8000000000000000ULL} },{ // min-> {0x0000000000000001ULL,0x8000000000000001ULL}, {0x0FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}, {0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL} },{ // NaN , -NaN {0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x0000000000000001ULL,0x0000000000000001ULL}, {0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}, {0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL} },{ {0ULL,0ULL}, {0ULL,0ULL}, {0ULL,0ULL}, {0ULL,0ULL}, {0ULL,0ULL}, {0ULL,0ULL} } }; int ii, test_ctr = 1; char msg[80]; vec_double2 res_v; TEST_SET_START("20060905160000NM","NM", "ldexpd2"); TEST_START("ldexpd2"); for (ii=0; ; ii++) { if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break; // set Floating point round mode spu_mtfpscr(((vec_uint4){0x0100,0,0,0})); res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0])); sprintf(msg,"2006090516%04dNM", test_ctr++); TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0); #ifdef LDEXPD2_ROUND spu_mtfpscr(((vec_uint4){0x0600,0,0,0})); res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0])); sprintf(msg,"2006090516%04dNM", test_ctr++); TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0); spu_mtfpscr(((vec_uint4){0x0b00,0,0,0})); res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0])); sprintf(msg,"2006090516%04dNM", test_ctr++); TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0); spu_mtfpscr(((vec_uint4){0x0c00,0,0,0})); res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0])); sprintf(msg,"2006090516%04dNM", test_ctr++); TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0); #endif // LDEXPD2_ROUND } TEST_SET_DONE(); TEST_EXIT(); }
int Writer::svc() { try { ::DDS::Topic_var topic = writer_->get_topic(); CORBA::String_var topic_name = topic->get_name(); ACE_DEBUG((LM_DEBUG,"(%P|%t) %C: Writer::svc begins.\n", topic_name.in())); if (!ACE_OS::strcmp(topic_name, MY_TOPIC1) || !ACE_OS::strcmp(topic_name, MY_TOPIC3) || !ACE_OS::strcmp(topic_name, MY_TOPIC4) || !ACE_OS::strcmp(topic_name, MY_TOPIC5) || !ACE_OS::strcmp(topic_name, MY_TOPIC6) || !ACE_OS::strcmp(topic_name, MY_TOPIC7)) { OpenDDS::Model::WriterSync::wait_match(writer_); ::T1::Foo1 foo; foo.x = -1; foo.y = -1; foo.key = ++key; ::T1::Foo1DataWriter_var foo_dw = ::T1::Foo1DataWriter::_narrow(writer_); TEST_CHECK(!CORBA::is_nil(foo_dw)); ACE_OS::sleep(2); ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) %T Writer::svc starting to write.\n"))); ::DDS::InstanceHandle_t handle = foo_dw->register_instance(foo); for (int i = 0; i < num_writes_per_thread_; ++i) { rsleep(); foo.x = (float)i; foo.c = 'A' + (i % 26); foo_dw->write(foo, handle); } } else if (!ACE_OS::strcmp(topic_name, MY_TOPIC2)) { OpenDDS::Model::WriterSync::wait_match(writer_, 3 /*expected readers*/); ::T4::Foo4 foo; foo.key = ++key; ::T4::Foo4DataWriter_var foo_dw = ::T4::Foo4DataWriter::_narrow(writer_); TEST_CHECK(!CORBA::is_nil(foo_dw)); ACE_OS::sleep(2); ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) %T Writer::svc starting to write.\n"))); ::DDS::InstanceHandle_t handle = foo_dw->register_instance(foo); for (int i = 0; i < num_writes_per_thread_; ++i) { rsleep(); const int sequence_length = 10; foo.values.length(sequence_length); for (int j = 0; j < sequence_length; ++j) { foo.values[j] = (float) (i * i - j); } foo_dw->write(foo, handle); } } } catch (const CORBA::Exception& ex) { ex._tao_print_exception("Exception caught in svc:"); } finished_sending_ = true; ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writer::svc finished.\n"))); return 0; }
int Writer::svc () { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writer::svc \n"))); try { ::Xyz::Foo foo; foo.sample_sequence = -1; foo.handle_value = -1; foo.writer_id = writer_id_; if (multiple_instances_ == 1) { // Use the thread id as the instance key. foo.a_long_value = (CORBA::Long) (ACE_OS::thr_self ()); } else { foo.a_long_value = default_key; } ::Xyz::FooDataWriter_var foo_dw = ::Xyz::FooDataWriter::_narrow(writer_.in ()); TEST_CHECK (! CORBA::is_nil (foo_dw.in ())); for (int i = 0; i< num_writes_per_thread_; i ++) { ::DDS::InstanceHandle_t handle = foo_dw->_cxx_register (foo); foo.handle_value = handle; // The sequence number will be increased after the insert. TEST_CHECK (data_map_.insert (handle, foo) == 0); ::DDS::ReturnCode_t ret = ::DDS::RETCODE_OK; if (has_key_ == 1) { ::Xyz::Foo key_holder; ret = foo_dw->get_key_value(key_holder, handle); TEST_CHECK(ret == ::DDS::RETCODE_OK); // check for equality TEST_CHECK (foo.a_long_value == key_holder.a_long_value); // It is the instance key. } ret = foo_dw->write(foo, handle); TEST_CHECK (ret == ::DDS::RETCODE_OK); if (write_delay_msec_ > 0) { ACE_Time_Value delay (write_delay_msec_/1000, write_delay_msec_%1000 * 1000); ACE_OS::sleep (delay); } } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught in svc:"); } if (check_data_dropped_ == 1 && writer_servant_->data_dropped_count_ > 0) { while (writer_servant_->data_delivered_count_ + writer_servant_->data_dropped_count_ < num_writes_per_thread_ * num_thread_to_write_) { ACE_OS::sleep (1); } ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writer::svc data_delivered_count=%d data_dropped_count=%d\n"), writer_servant_->data_delivered_count_, writer_servant_->data_dropped_count_)); if (writer_servant_->data_dropped_count_ > 0) { pubdriver_->shutdown_ = 1; } } return 0; }
static int test_check_boot_down(void) { TEST_CHECK(keyboard_scan_get_boot_keys() == BOOT_KEY_DOWN_ARROW); }
int main(int argc, char** argv) { TEST_CHECK(testNonSymmetric); TEST_CHECK(testSymmetric); return 0; }
void test_set_19(void) { /* * Inputs */ uint8_t ki[] = { 0x51, 0x22, 0x25, 0x02, 0x14, 0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0 }; uint8_t rand[] = { 0x81, 0xe9, 0x2b, 0x6c, 0x0e, 0xe0, 0xe1, 0x2e, 0xbc, 0xeb, 0xa8, 0xd9, 0x2a, 0x99, 0xdf, 0xa5 }; uint8_t sqn[] = { 0x16, 0xf3, 0xb3, 0xf7, 0x0f, 0xc2 }; uint8_t amf[] = { 0xc3, 0xab }; uint8_t op[] = { 0xc9, 0xe8, 0x76, 0x32, 0x86, 0xb5, 0xb9, 0xff, 0xbd, 0xf5, 0x6e, 0x12, 0x97, 0xd0, 0x88, 0x7b }; uint8_t opc[] = { 0x98, 0x1d, 0x46, 0x4c, 0x7c, 0x52, 0xeb, 0x6e, 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf }; /* * Outputs */ uint8_t opc_out[MILENAGE_OPC_SIZE]; uint8_t mac_a_out[MILENAGE_MAC_A_SIZE]; uint8_t mac_s_out[MILENAGE_MAC_S_SIZE]; uint8_t res_out[MILENAGE_RES_SIZE]; uint8_t ck_out[MILENAGE_CK_SIZE]; uint8_t ik_out[MILENAGE_IK_SIZE]; uint8_t ak_out[MILENAGE_AK_SIZE]; uint8_t ak_resync_out[MILENAGE_AK_SIZE]; /* function 1 */ uint8_t mac_a[] = { 0x2a, 0x5c, 0x23, 0xd1, 0x5e, 0xe3, 0x51, 0xd5 }; /* function 1* */ uint8_t mac_s[] = { 0x62, 0xda, 0xe3, 0x85, 0x3f, 0x3a, 0xf9, 0xd2 }; /* function 2 */ uint8_t res[] = { 0x28, 0xd7, 0xb0, 0xf2, 0xa2, 0xec, 0x3d, 0xe5 }; /* function 3 */ uint8_t ck[] = { 0x53, 0x49, 0xfb, 0xe0, 0x98, 0x64, 0x9f, 0x94, 0x8f, 0x5d, 0x2e, 0x97, 0x3a, 0x81, 0xc0, 0x0f }; /* function 4 */ uint8_t ik[] = { 0x97, 0x44, 0x87, 0x1a, 0xd3, 0x2b, 0xf9, 0xbb, 0xd1, 0xdd, 0x5c, 0xe5, 0x4e, 0x3e, 0x2e, 0x5a }; /* function 5 */ uint8_t ak[] = { 0xad, 0xa1, 0x5a, 0xeb, 0x7b, 0xb8 }; /* function 5* */ uint8_t ak_resync[] = { 0xd4, 0x61, 0xbc, 0x15, 0x47, 0x5d }; int ret = 0; /* fr_log_fp = stdout; fr_debug_lvl = 4; */ ret = milenage_opc_generate(opc_out, op, ki); TEST_CHECK(ret == 0); FR_PROTO_HEX_DUMP(opc_out, sizeof(opc_out), "opc"); TEST_CHECK(memcmp(opc_out, opc, sizeof(opc_out)) == 0); if ((milenage_f1(mac_a_out, mac_s_out, opc, ki, rand, sqn, amf) < 0) || (milenage_f2345(res_out, ik_out, ck_out, ak_out, ak_resync_out, opc, ki, rand) < 0)) ret = -1; FR_PROTO_HEX_DUMP(mac_a, sizeof(mac_a_out), "mac_a"); FR_PROTO_HEX_DUMP(mac_s, sizeof(mac_s_out), "mac_s"); FR_PROTO_HEX_DUMP(ik_out, sizeof(ik_out), "ik"); FR_PROTO_HEX_DUMP(ck_out, sizeof(ck_out), "ck"); FR_PROTO_HEX_DUMP(res_out, sizeof(res_out), "res"); FR_PROTO_HEX_DUMP(ak_out, sizeof(ak_out), "ak"); FR_PROTO_HEX_DUMP(ak_resync_out, sizeof(ak_resync_out), "ak_resync"); TEST_CHECK(ret == 0); TEST_CHECK(memcmp(mac_a_out, mac_a, sizeof(mac_a_out)) == 0); TEST_CHECK(memcmp(mac_s_out, mac_s, sizeof(mac_s_out)) == 0); TEST_CHECK(memcmp(res_out, res, sizeof(res_out)) == 0); TEST_CHECK(memcmp(ck_out, ck, sizeof(ck_out)) == 0); TEST_CHECK(memcmp(ik_out, ik, sizeof(ik_out)) == 0); TEST_CHECK(memcmp(ak_out, ak, sizeof(ak_out)) == 0); TEST_CHECK(memcmp(ak_resync, ak_resync, sizeof(ak_resync_out)) == 0); }
} TEST_END TEST(nodemcu_full_fs_2) { fs_reset_specific(0, 0, 4096*22, 4096, 4096, 256); int res; spiffs_file fd; printf(" fill up system by writing one byte a lot\n"); fd = SPIFFS_open(FS, "test1.txt", SPIFFS_RDWR | SPIFFS_CREAT | SPIFFS_TRUNC, 0); TEST_CHECK(fd > 0); int i; spiffs_stat s; res = SPIFFS_OK; for (i = 0; i < 100*1000; i++) { u8_t buf = 'x'; res = SPIFFS_write(FS, fd, &buf, 1); } int errno = SPIFFS_errno(FS); int res2 = SPIFFS_fstat(FS, fd, &s); TEST_CHECK(res2 == SPIFFS_OK); printf(" >>> file %s size: %i\n", s.name, s.size); TEST_CHECK(errno == SPIFFS_ERR_FULL); SPIFFS_close(FS, fd); res2 = SPIFFS_stat(FS, "test1.txt", &s); TEST_CHECK(res2 == SPIFFS_OK); SPIFFS_clearerr(FS); printf(" create small file\n"); fd = SPIFFS_open(FS, "test2.txt", SPIFFS_RDWR | SPIFFS_CREAT | SPIFFS_TRUNC, 0); #if 0 // before gc in v3.1 TEST_CHECK(SPIFFS_errno(FS) == SPIFFS_OK); TEST_CHECK(fd > 0); for (i = 0; i < 1000; i++) { u8_t buf = 'x'; res = SPIFFS_write(FS, fd, &buf, 1); } TEST_CHECK(SPIFFS_errno(FS) == SPIFFS_ERR_FULL); res2 = SPIFFS_fstat(FS, fd, &s); TEST_CHECK(res2 == SPIFFS_OK); printf(" >>> file %s size: %i\n", s.name, s.size); TEST_CHECK(s.size == 0); SPIFFS_clearerr(FS); #else TEST_CHECK(SPIFFS_errno(FS) == SPIFFS_ERR_FULL); SPIFFS_clearerr(FS); #endif printf(" remove files\n"); res = SPIFFS_remove(FS, "test1.txt"); TEST_CHECK(res == SPIFFS_OK); #if 0 res = SPIFFS_remove(FS, "test2.txt"); TEST_CHECK(res == SPIFFS_OK); #endif printf(" create medium file\n"); fd = SPIFFS_open(FS, "test3.txt", SPIFFS_RDWR | SPIFFS_CREAT | SPIFFS_TRUNC, 0); TEST_CHECK(SPIFFS_errno(FS) == SPIFFS_OK); TEST_CHECK(fd > 0); for (i = 0; i < 20*1000; i++) { u8_t buf = 'x'; res = SPIFFS_write(FS, fd, &buf, 1); } TEST_CHECK(SPIFFS_errno(FS) == SPIFFS_OK); res2 = SPIFFS_fstat(FS, fd, &s); TEST_CHECK(res2 == SPIFFS_OK); printf(" >>> file %s size: %i\n", s.name, s.size); TEST_CHECK(s.size == 20*1000); return TEST_RES_OK; } TEST_END
int main() { TEST_SET_START("20060905000000AAN","AAN", "logbf4"); // -Norm (IEEE-754: -Nan) float x0 = hide_float(make_float(0xFFC00000)); float r0 = 128.0f; // -Norm (IEEE-754: -Inf) float x1 = hide_float(-HUGE_VALF); float r1 = 128.0f; // -Smax float x2 = hide_float(-FLT_MAX); float r2 = 128.0f; // -Norm float x3 = hide_float(-824842.58421394); float r3 = 19.0f; // -Smin float x4 = hide_float(make_float(0x80800000)); float r4 = -126.0f; // -Denorm float x5 = hide_float(make_float(0x807AAAAA)); float r5 = -HUGE_VALF; // -Unf float x6 = hide_float(-1.0e-999); float r6 = -HUGE_VALF; // -0 float x7 = hide_float(-0.0); float r7 = -HUGE_VALF; // 0 float x8 = hide_float( 0.0); float r8 = -HUGE_VALF; // +Unf float x9 = hide_float( 1.0e-999); float r9 = -HUGE_VALF; // +Denorm float x10 = hide_float(make_float(0x007AAAAA)); float r10 = -HUGE_VALF; // +Smin float x11 = hide_float(make_float(0x00800000)); float r11 = -126.0f; // +Norm float x12 = hide_float(3.14152634); float r12 = 1.0f; // +Norm float x13 = hide_float(7.0673903e37); float r13 = 125.0f; // +Norm float x14 = hide_float(2.4673e14); float r14 = 47.0f; // +Norm float x15 = hide_float(7.235672e-25); float r15 = -81.0f; // +Norm float x16 = hide_float(9.452854e17); float r16 = 59.0f; // +Norm float x17 = hide_float(3.045784e-18); float r17 = -59.0f; // -Norm float x18 = hide_float(-6.459273e7); float r18 = 25.0f; // -Norm float x19 = hide_float(-2.493472e-9); float r19 = -29.0f; // -Norm float x20 = hide_float(-1.4824543e28); float r20 = 93.0f; // -Norm float x21 = hide_float(-5.53856231e-27); float r21 = -88.0f; // -Norm float x22 = hide_float(-1.000001); float r22 = 0.0f; // +Smax float x23 = hide_float(FLT_MAX); float r23 = 128.0f; //+Norm (IEEE-754: +Inf) float x24 = hide_float(HUGE_VALF); float r24 = 128.0f; //+Norm (IEEE-754: +Nan) float x25 = hide_float(make_float(0x7FC00000)); float r25 = 128.0f; // Compound vec_float4 x26_v = (vec_float4) { -2.561286432e10, FLT_MAX, -1.0e-999, 7.235672e-25 }; vec_float4 r26_v = (vec_float4) { 34.0f, 128.0f, -HUGE_VALF, -81.0f }; // Compound vec_float4 x27_v = (vec_float4) { 345.27533f, 7.0673903e37, -0.0f, -2.40e-310 }; vec_float4 r27_v = (vec_float4) { 8.0f, 125.0f, -HUGE_VALF, -HUGE_VALF }; // Compound vec_float4 x28_v = (vec_float4) { make_float(0x7FC00000), -824842.58421394f, -0.0f, -3678342.8765343f }; vec_float4 r28_v = (vec_float4) { 128.0f, 19.0f, -HUGE_VALF, 21.0f }; // Compound vec_float4 x29_v = (vec_float4) { HUGE_VALF, 1.0e-99, -5.53856231e-27, make_float(0xFFC00000) }; vec_float4 r29_v = (vec_float4) { 128.0f, -HUGE_VALF, -88.0f, 128.0f }; // Compound vec_float4 x30_v = (vec_float4) { 1.2e-57, -1.2e-19, 3.045784e-18, -HUGE_VALF } ; vec_float4 r30_v = (vec_float4) { -HUGE_VALF, -63.0f, -59.0f, 128.0f }; vec_float4 x0_v = spu_splats(x0); vec_float4 r0_v = spu_splats(r0); vec_float4 x1_v = spu_splats(x1); vec_float4 r1_v = spu_splats(r1); vec_float4 x2_v = spu_splats(x2); vec_float4 r2_v = spu_splats(r2); vec_float4 x3_v = spu_splats(x3); vec_float4 r3_v = spu_splats(r3); vec_float4 x4_v = spu_splats(x4); vec_float4 r4_v = spu_splats(r4); vec_float4 x5_v = spu_splats(x5); vec_float4 r5_v = spu_splats(r5); vec_float4 x6_v = spu_splats(x6); vec_float4 r6_v = spu_splats(r6); vec_float4 x7_v = spu_splats(x7); vec_float4 r7_v = spu_splats(r7); vec_float4 x8_v = spu_splats(x8); vec_float4 r8_v = spu_splats(r8); vec_float4 x9_v = spu_splats(x9); vec_float4 r9_v = spu_splats(r9); vec_float4 x10_v = spu_splats(x10); vec_float4 r10_v = spu_splats(r10); vec_float4 x11_v = spu_splats(x11); vec_float4 r11_v = spu_splats(r11); vec_float4 x12_v = spu_splats(x12); vec_float4 r12_v = spu_splats(r12); vec_float4 x13_v = spu_splats(x13); vec_float4 r13_v = spu_splats(r13); vec_float4 x14_v = spu_splats(x14); vec_float4 r14_v = spu_splats(r14); vec_float4 x15_v = spu_splats(x15); vec_float4 r15_v = spu_splats(r15); vec_float4 x16_v = spu_splats(x16); vec_float4 r16_v = spu_splats(r16); vec_float4 x17_v = spu_splats(x17); vec_float4 r17_v = spu_splats(r17); vec_float4 x18_v = spu_splats(x18); vec_float4 r18_v = spu_splats(r18); vec_float4 x19_v = spu_splats(x19); vec_float4 r19_v = spu_splats(r19); vec_float4 x20_v = spu_splats(x20); vec_float4 r20_v = spu_splats(r20); vec_float4 x21_v = spu_splats(x21); vec_float4 r21_v = spu_splats(r21); vec_float4 x22_v = spu_splats(x22); vec_float4 r22_v = spu_splats(r22); vec_float4 x23_v = spu_splats(x23); vec_float4 r23_v = spu_splats(r23); vec_float4 x24_v = spu_splats(x24); vec_float4 r24_v = spu_splats(r24); vec_float4 x25_v = spu_splats(x25); vec_float4 r25_v = spu_splats(r25); vec_float4 res_v; TEST_START("logbf4"); res_v = (vec_float4)logbf4(x0_v); TEST_CHECK("20060905000000AAN", allequal_float4( res_v, r0_v ), 0); res_v = (vec_float4)logbf4(x1_v); TEST_CHECK("20060905000001AAN", allequal_float4( res_v, r1_v ), 0); res_v = (vec_float4)logbf4(x2_v); TEST_CHECK("20060905000002AAN", allequal_float4( res_v, r2_v ), 0); res_v = (vec_float4)logbf4(x3_v); TEST_CHECK("20060905000003AAN", allequal_float4( res_v, r3_v ), 0); res_v = (vec_float4)logbf4(x4_v); TEST_CHECK("20060905000004AAN", allequal_float4( res_v, r4_v ), 0); res_v = (vec_float4)logbf4(x5_v); TEST_CHECK("20060905000005AAN", allequal_float4( res_v, r5_v ), 0); res_v = (vec_float4)logbf4(x6_v); TEST_CHECK("20060905000006AAN", allequal_float4( res_v, r6_v ), 0); res_v = (vec_float4)logbf4(x7_v); TEST_CHECK("20060905000007AAN", allequal_float4( res_v, r7_v ), 0); res_v = (vec_float4)logbf4(x8_v); TEST_CHECK("20060905000008AAN", allequal_float4( res_v, r8_v ), 0); res_v = (vec_float4)logbf4(x9_v); TEST_CHECK("20060905000009AAN", allequal_float4( res_v, r9_v ), 0); res_v = (vec_float4)logbf4(x10_v); TEST_CHECK("20060905000010AAN", allequal_float4( res_v, r10_v ), 0); res_v = (vec_float4)logbf4(x11_v); TEST_CHECK("20060905000011AAN", allequal_float4( res_v, r11_v ), 0); res_v = (vec_float4)logbf4(x12_v); TEST_CHECK("20060905000012AAN", allequal_float4( res_v, r12_v ), 0); res_v = (vec_float4)logbf4(x13_v); TEST_CHECK("20060905000013AAN", allequal_float4( res_v, r13_v ), 0); res_v = (vec_float4)logbf4(x14_v); TEST_CHECK("20060905000014AAN", allequal_float4( res_v, r14_v ), 0); res_v = (vec_float4)logbf4(x15_v); TEST_CHECK("20060905000015AAN", allequal_float4( res_v, r15_v ), 0); res_v = (vec_float4)logbf4(x16_v); TEST_CHECK("20060905000016AAN", allequal_float4( res_v, r16_v ), 0); res_v = (vec_float4)logbf4(x17_v); TEST_CHECK("20060905000017AAN", allequal_float4( res_v, r17_v ), 0); res_v = (vec_float4)logbf4(x18_v); TEST_CHECK("20060905000018AAN", allequal_float4( res_v, r18_v ), 0); res_v = (vec_float4)logbf4(x19_v); TEST_CHECK("20060905000019AAN", allequal_float4( res_v, r19_v ), 0); res_v = (vec_float4)logbf4(x20_v); TEST_CHECK("20060905000020AAN", allequal_float4( res_v, r20_v ), 0); res_v = (vec_float4)logbf4(x21_v); TEST_CHECK("20060905000021AAN", allequal_float4( res_v, r21_v ), 0); res_v = (vec_float4)logbf4(x22_v); TEST_CHECK("20060905000022AAN", allequal_float4( res_v, r22_v ), 0); res_v = (vec_float4)logbf4(x23_v); TEST_CHECK("20060905000023AAN", allequal_float4( res_v, r23_v ), 0); res_v = (vec_float4)logbf4(x24_v); TEST_CHECK("20060905000024AAN", allequal_float4( res_v, r24_v ), 0); res_v = (vec_float4)logbf4(x25_v); TEST_CHECK("20060905000025AAN", allequal_float4( res_v, r25_v ), 0); res_v = (vec_float4)logbf4(x26_v); TEST_CHECK("20060905000026AAN", allequal_float4( res_v, r26_v ), 0); res_v = (vec_float4)logbf4(x27_v); TEST_CHECK("20060905000027AAN", allequal_float4( res_v, r27_v ), 0); res_v = (vec_float4)logbf4(x28_v); TEST_CHECK("20060905000028AAN", allequal_float4( res_v, r28_v ), 0); res_v = (vec_float4)logbf4(x29_v); TEST_CHECK("20060905000029AAN", allequal_float4( res_v, r29_v ), 0); res_v = (vec_float4)logbf4(x30_v); TEST_CHECK("20060905000030AAN", allequal_float4( res_v, r30_v ), 0); TEST_SET_DONE(); TEST_EXIT(); }
static void check_ocb_long(size_t nkey, const void *expect_tag, size_t ntag) { uint8_t C[22400]; uint8_t K[32]; uint8_t S[128] = { 0 }; uint8_t N[12] = { 0 }; size_t nC = 0; memset(K, 0, sizeof K); K[nkey - 1] = ntag * 8; cf_aes_context aes; cf_aes_init(&aes, K, nkey); for (size_t i = 0; i < 128; i++) { /* N = num2str(3i+1, 96) */ memset(N, 0, sizeof N); write32_be(3 * i + 1, N + 8); /* C = C || OCB-ENCRYPT(K, N, S, S) * nb. OCB-ENCRYPT(Key, Nonce, AAD, Plain) */ cf_ocb_encrypt(&cf_aes, &aes, S, i, /* plain */ S, i, /* aad */ N, sizeof N, /* nonce */ C + nC, /* cipher out */ C + nC + i, /* tag out */ ntag); nC += i + ntag; /* N = num2str(3i+2,96) */ write32_be(3 * i + 2, N + 8); /* C = C || OCB-ENCRYPT(K, N, <empty string>, S) */ cf_ocb_encrypt(&cf_aes, &aes, S, i, NULL, 0, N, sizeof N, C + nC, C + nC + i, ntag); nC += i + ntag; /* N = num2str(3i+3,96) */ write32_be(3 * i + 3, N + 8); /* C = C || OCB-ENCRYPT(K, N, S, <empty string>) */ cf_ocb_encrypt(&cf_aes, &aes, NULL, 0, S, i, N, sizeof N, NULL, C + nC, ntag); nC += ntag; } /* N = num2str(385, 96) */ write32_be(385, N + 8); /* Output : OCB-ENCRYPT(K, N, C, <empty string>) */ uint8_t result[16]; cf_ocb_encrypt(&cf_aes, &aes, NULL, 0, C, nC, N, sizeof N, NULL, result, ntag); TEST_CHECK(memcmp(result, expect_tag, ntag) == 0); }
static bool test_reset(struct ConfigSet *cs, struct Buffer *err) { log_line(__func__); const char *name = "Lemon"; mutt_buffer_reset(err); char *addr = VarLemon ? VarLemon->mailbox : NULL; TEST_MSG("Initial: %s = '%s'\n", name, NONULL(addr)); int rc = cs_str_string_set(cs, name, "*****@*****.**", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; addr = VarLemon ? VarLemon->mailbox : NULL; TEST_MSG("Set: %s = '%s'\n", name, NONULL(addr)); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", err->data); return false; } addr = VarLemon ? VarLemon->mailbox : NULL; if (!TEST_CHECK(mutt_str_strcmp(addr, "*****@*****.**") == 0)) { TEST_MSG("Value of %s wasn't changed\n", name); return false; } TEST_MSG("Reset: %s = '%s'\n", name, NONULL(addr)); name = "Mango"; mutt_buffer_reset(err); TEST_MSG("Initial: %s = '%s'\n", name, VarMango->mailbox); dont_fail = true; rc = cs_str_string_set(cs, name, "*****@*****.**", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; TEST_MSG("Set: %s = '%s'\n", name, VarMango->mailbox); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { TEST_MSG("Expected error: %s\n", err->data); } else { TEST_MSG("%s\n", err->data); return false; } if (!TEST_CHECK(mutt_str_strcmp(VarMango->mailbox, "*****@*****.**") == 0)) { TEST_MSG("Value of %s changed\n", name); return false; } TEST_MSG("Reset: %s = '%s'\n", name, VarMango->mailbox); log_line(__func__); return true; }
int main() { TEST_SET_START("20060822000000AAN","AAN", "isnormalf4"); float x0 = hide_float(-0.0f); unsigned int r0 = 0x00000000; float x1 = hide_float(-FLT_MAX); //-Smax unsigned int r1 = 0xffffffff; float x2 = hide_float( 0.0f); unsigned int r2 = 0x00000000; float x3 = hide_float(-168.97345223013f); unsigned int r3 = 0xffffffff; float x4 = hide_float(-1e-999); //-Smin unsigned int r4 = 0x00000000; float x5 = hide_float(876543.12345f); unsigned int r5 = 0xffffffff; float x6 = hide_float(1e-999); // Smin unsigned int r6 = 0x00000000; float x7 = hide_float(5172.2845321f); unsigned int r7 = 0xffffffff; float x8 = hide_float(2353705.31415f); unsigned int r8 = 0xffffffff; float x9 = hide_float(FLT_MAX); // Smax unsigned int r9 = 0xffffffff; vec_float4 x0_v = spu_splats(x0); vec_uint4 r0_v = spu_splats(r0); vec_float4 x1_v = spu_splats(x1); vec_uint4 r1_v = spu_splats(r1); vec_float4 x2_v = spu_splats(x2); vec_uint4 r2_v = spu_splats(r2); vec_float4 x3_v = spu_splats(x3); vec_uint4 r3_v = spu_splats(r3); vec_float4 x4_v = spu_splats(x4); vec_uint4 r4_v = spu_splats(r4); vec_float4 x5_v = spu_splats(x5); vec_uint4 r5_v = spu_splats(r5); vec_float4 x6_v = spu_splats(x6); vec_uint4 r6_v = spu_splats(r6); vec_float4 x7_v = spu_splats(x7); vec_uint4 r7_v = spu_splats(r7); vec_float4 x8_v = spu_splats(x8); vec_uint4 r8_v = spu_splats(r8); vec_float4 x9_v = spu_splats(x9); vec_uint4 r9_v = spu_splats(r9); vec_uint4 res_v; TEST_START("isnormalf4"); res_v = (vec_uint4)isnormalf4(x0_v); TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0); res_v = (vec_uint4)isnormalf4(x1_v); TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0); res_v = (vec_uint4)isnormalf4(x2_v); TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0); res_v = (vec_uint4)isnormalf4(x3_v); TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0); res_v = (vec_uint4)isnormalf4(x4_v); TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0); res_v = (vec_uint4)isnormalf4(x5_v); TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0); res_v = (vec_uint4)isnormalf4(x6_v); TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0); res_v = (vec_uint4)isnormalf4(x7_v); TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0); res_v = (vec_uint4)isnormalf4(x8_v); TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0); res_v = (vec_uint4)isnormalf4(x9_v); TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0); TEST_SET_DONE(); TEST_EXIT(); }
static bool test_validator(struct ConfigSet *cs, struct Buffer *err) { log_line(__func__); char *addr = NULL; struct Address *a = address_new("*****@*****.**"); bool result = false; const char *name = "Nectarine"; mutt_buffer_reset(err); int rc = cs_str_string_set(cs, name, "*****@*****.**", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", err->data); } else { TEST_MSG("%s\n", err->data); goto tv_out; } addr = VarNectarine ? VarNectarine->mailbox : NULL; TEST_MSG("Address: %s = %s\n", name, NONULL(addr)); mutt_buffer_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", err->data); } else { TEST_MSG("%s\n", err->data); goto tv_out; } addr = VarNectarine ? VarNectarine->mailbox : NULL; TEST_MSG("Native: %s = %s\n", name, NONULL(addr)); name = "Olive"; mutt_buffer_reset(err); rc = cs_str_string_set(cs, name, "*****@*****.**", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", err->data); } else { TEST_MSG("%s\n", err->data); goto tv_out; } addr = VarOlive ? VarOlive->mailbox : NULL; TEST_MSG("Address: %s = %s\n", name, NONULL(addr)); mutt_buffer_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", err->data); } else { TEST_MSG("%s\n", err->data); goto tv_out; } addr = VarOlive ? VarOlive->mailbox : NULL; TEST_MSG("Native: %s = %s\n", name, NONULL(addr)); name = "Papaya"; mutt_buffer_reset(err); rc = cs_str_string_set(cs, name, "*****@*****.**", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { TEST_MSG("Expected error: %s\n", err->data); } else { TEST_MSG("%s\n", err->data); goto tv_out; } addr = VarPapaya ? VarPapaya->mailbox : NULL; TEST_MSG("Address: %s = %s\n", name, NONULL(addr)); mutt_buffer_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { TEST_MSG("Expected error: %s\n", err->data); } else { TEST_MSG("%s\n", err->data); goto tv_out; } addr = VarPapaya ? VarPapaya->mailbox : NULL; TEST_MSG("Native: %s = %s\n", name, NONULL(addr)); result = true; tv_out: address_free(&a); log_line(__func__); return result; }
int main() { TEST_CHECK(testAngleVN); TEST_CHECK(testAngleV); return 0; }
static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) { log_line(__func__); bool result = false; const char *account = "fruit"; const char *parent = "Quince"; char child[128]; snprintf(child, sizeof(child), "%s:%s", account, parent); const char *AccountVarAddr[] = { parent, NULL, }; struct CfgAccount *ac = ac_new(cs, account, AccountVarAddr); // set parent mutt_buffer_reset(err); int rc = cs_str_string_set(cs, parent, "*****@*****.**", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("Error: %s\n", err->data); goto ti_out; } dump_native(cs, parent, child); // set child mutt_buffer_reset(err); rc = cs_str_string_set(cs, child, "*****@*****.**", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("Error: %s\n", err->data); goto ti_out; } dump_native(cs, parent, child); // reset child mutt_buffer_reset(err); rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("Error: %s\n", err->data); goto ti_out; } dump_native(cs, parent, child); // reset parent mutt_buffer_reset(err); rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("Error: %s\n", err->data); goto ti_out; } dump_native(cs, parent, child); log_line(__func__); result = true; ti_out: ac_free(cs, &ac); return result; }
void test_scoreboard_helper(IScoreboard *pScoreboard) { bool bRes = false; unsigned int uVal = 0; // Test to make sure that scoreboard has been initialized to all 0's for (unsigned int u = 0; u < IScoreboard::DIGIT_COUNT; u++) { bRes = pScoreboard->pre_get_digit(uVal, (IScoreboard::WhichDigit) u); TEST_REQUIRE(bRes); TEST_CHECK_EQUAL(uVal, 0x0F); } // try a value that's out of range bRes = pScoreboard->pre_get_digit(uVal, IScoreboard::DIGIT_COUNT); TEST_CHECK(!bRes); // now try the convenience functions // CREDITS // out of range bRes = pScoreboard->update_credits(2, 0); // try a value out of range TEST_CHECK(!bRes); // out of range 2 bRes = pScoreboard->update_credits(0, 17); // try a value out of range TEST_CHECK(!bRes); // in range bRes = pScoreboard->update_credits(1, 5); TEST_CHECK(bRes); bRes = pScoreboard->pre_get_digit(uVal, IScoreboard::CREDITS1_1); TEST_CHECK_EQUAL(uVal, 5); // PLAYER LIVES // out of range bRes = pScoreboard->update_player_lives(0, 2); TEST_CHECK(!bRes); // within range bRes = pScoreboard->update_player_lives(9, 1); TEST_CHECK(bRes); // make sure value is correct bRes = pScoreboard->pre_get_digit(uVal, IScoreboard::LIVES1); TEST_CHECK_EQUAL(uVal, 9); // test annunciator value bRes = pScoreboard->update_player_lives(0x0C, 1); TEST_CHECK(bRes); // PLAYER SCORE // out of range on digit bRes = pScoreboard->update_player_score(6, 0, 0); TEST_CHECK(!bRes); // out of range on player bRes = pScoreboard->update_player_score(5, 0, 2); TEST_CHECK(!bRes); // should pass bRes = pScoreboard->update_player_score(5, 9, 1); TEST_CHECK(bRes); bRes = pScoreboard->pre_get_digit(uVal, IScoreboard::PLAYER2_5); TEST_CHECK_EQUAL(uVal, 9); // make sure that player1's digit hasn't changed bRes = pScoreboard->pre_get_digit(uVal, IScoreboard::PLAYER1_5); TEST_CHECK_EQUAL(uVal, 0xF); // test annunciator values bRes = pScoreboard->update_player_score(4, 0x0C, 0); TEST_CHECK(bRes); // now test player 1's score bRes = pScoreboard->update_player_score(1, 6, 0); TEST_CHECK(bRes); bRes = pScoreboard->pre_get_digit(uVal, IScoreboard::PLAYER1_1); TEST_CHECK_EQUAL(uVal, 6); }
static bool test_initial_values(struct ConfigSet *cs, struct Buffer *err) { log_line(__func__); TEST_MSG("Apple = '%s'\n", VarApple->mailbox); TEST_MSG("Banana = '%s'\n", VarBanana->mailbox); const char *apple_orig = "*****@*****.**"; const char *banana_orig = "*****@*****.**"; if (!TEST_CHECK(mutt_str_strcmp(VarApple->mailbox, apple_orig) == 0)) { TEST_MSG("Error: initial values were wrong\n"); return false; } if (!TEST_CHECK(mutt_str_strcmp(VarBanana->mailbox, banana_orig) == 0)) { TEST_MSG("Error: initial values were wrong\n"); return false; } cs_str_string_set(cs, "Apple", "*****@*****.**", err); cs_str_string_set(cs, "Banana", NULL, err); struct Buffer value; mutt_buffer_init(&value); value.dsize = 256; value.data = mutt_mem_calloc(1, value.dsize); mutt_buffer_reset(&value); int rc; mutt_buffer_reset(&value); rc = cs_str_initial_get(cs, "Apple", &value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", value.data); FREE(&value.data); return false; } if (!TEST_CHECK(mutt_str_strcmp(value.data, apple_orig) == 0)) { TEST_MSG("Apple's initial value is wrong: '%s'\n", value.data); FREE(&value.data); return false; } TEST_MSG("Apple = '%s'\n", VarApple->mailbox); TEST_MSG("Apple's initial value is '%s'\n", value.data); mutt_buffer_reset(&value); rc = cs_str_initial_get(cs, "Banana", &value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", value.data); FREE(&value.data); return false; } if (!TEST_CHECK(mutt_str_strcmp(value.data, banana_orig) == 0)) { TEST_MSG("Banana's initial value is wrong: '%s'\n", value.data); FREE(&value.data); return false; } TEST_MSG("Banana = '%s'\n", VarBanana ? VarBanana->mailbox : ""); TEST_MSG("Banana's initial value is '%s'\n", NONULL(value.data)); mutt_buffer_reset(&value); rc = cs_str_initial_set(cs, "Cherry", "*****@*****.**", &value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", value.data); FREE(&value.data); return false; } mutt_buffer_reset(&value); rc = cs_str_initial_set(cs, "Cherry", "*****@*****.**", &value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", value.data); FREE(&value.data); return false; } mutt_buffer_reset(&value); rc = cs_str_initial_get(cs, "Cherry", &value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { TEST_MSG("%s\n", value.data); FREE(&value.data); return false; } TEST_MSG("Cherry = '%s'\n", VarCherry ? VarCherry->mailbox : ""); TEST_MSG("Cherry's initial value is '%s'\n", NONULL(value.data)); FREE(&value.data); log_line(__func__); return true; }
int main() { TEST_SET_START("20060901150000MH","MH", "divu4"); unsigned int x0n = 0xffccb78d; unsigned int x0d = 0x0 ; unsigned int x0q = 0x0 ; unsigned int x0r = 0xffccb78d; unsigned int x1n = 0xff978333; unsigned int x1d = 0xff976bb6; unsigned int x1q = 0x1 ; unsigned int x1r = 0x177d ; unsigned int x2n = 0x5e146 ; unsigned int x2d = 0xd14ebe0e; unsigned int x2q = 0x0 ; unsigned int x2r = 0x5e146 ; unsigned int x3n = 0xf0e91618; unsigned int x3d = 0xfddff7ac; unsigned int x3q = 0x0 ; unsigned int x3r = 0xf0e91618; unsigned int x4n = 0xf2128d9d; unsigned int x4d = 0xe0f76 ; unsigned int x4q = 0x1137 ; unsigned int x4r = 0x66543 ; unsigned int x5n = 0xda1ba2ce; unsigned int x5d = 0x4c9 ; unsigned int x5q = 0x2d9482 ; unsigned int x5r = 0xbc ; unsigned int x6n = 0xdd4426a6; unsigned int x6d = 0xf8d245cf; unsigned int x6q = 0x0 ; unsigned int x6r = 0xdd4426a6; unsigned int x7n = 0xd1d5ae9 ; unsigned int x7d = 0x333ab105; unsigned int x7q = 0x0 ; unsigned int x7r = 0xd1d5ae9 ; unsigned int x8n = 0x3e0c6 ; unsigned int x8d = 0xfff24255; unsigned int x8q = 0x0 ; unsigned int x8r = 0x3e0c6 ; unsigned int x9n = 0xfd6fe27e; unsigned int x9d = 0xf32454 ; unsigned int x9q = 0x10a ; unsigned int x9r = 0xcc2336 ; unsigned int x10n =0xfb150f79; unsigned int x10d =0xf521 ; unsigned int x10q =0x10637 ; unsigned int x10r =0x9f62 ; unsigned int x11n =0xfe88071f; unsigned int x11d =0xfff937c2; unsigned int x11q =0x0 ; unsigned int x11r =0xfe88071f; unsigned int x12n =0xc374fa4 ; unsigned int x12d =0x1234 ; unsigned int x12q =0xabcd ; unsigned int x12r =0x0 ; unsigned int x13n =0xffffffff; unsigned int x13d =0x2 ; unsigned int x13q =0x7fffffff; unsigned int x13r =0x1 ; unsigned int x14n =0x0 ; unsigned int x14d =0x12345678; unsigned int x14q =0x0 ; unsigned int x14r =0x0 ; unsigned int x15n =0xffffffff; unsigned int x15d =0x1 ; unsigned int x15q =0xffffffff; unsigned int x15r =0x0 ; vec_uint4 x0n_v = (vec_uint4){ x0n, x1n, x2n, x3n }; vec_uint4 x1n_v = (vec_uint4){ x4n, x5n, x6n, x7n }; vec_uint4 x2n_v = (vec_uint4){ x8n, x9n, x10n, x11n }; vec_uint4 x3n_v = (vec_uint4){ x12n, x13n, x14n, x15n }; vec_uint4 x0d_v = (vec_uint4){ x0d, x1d, x2d, x3d }; vec_uint4 x1d_v = (vec_uint4){ x4d, x5d, x6d, x7d }; vec_uint4 x2d_v = (vec_uint4){ x8d, x9d, x10d, x11d }; vec_uint4 x3d_v = (vec_uint4){ x12d, x13d, x14d, x15d }; vec_uint4 x0q_v = (vec_uint4){ x0q, x1q, x2q, x3q }; vec_uint4 x1q_v = (vec_uint4){ x4q, x5q, x6q, x7q }; vec_uint4 x2q_v = (vec_uint4){ x8q, x9q, x10q, x11q }; vec_uint4 x3q_v = (vec_uint4){ x12q, x13q, x14q, x15q }; vec_uint4 x0r_v = (vec_uint4){ x0r, x1r, x2r, x3r }; vec_uint4 x1r_v = (vec_uint4){ x4r, x5r, x6r, x7r }; vec_uint4 x2r_v = (vec_uint4){ x8r, x9r, x10r, x11r }; vec_uint4 x3r_v = (vec_uint4){ x12r, x13r, x14r, x15r }; divu4_t res; TEST_START("divu4"); res = divu4(x0n_v, x0d_v); TEST_CHECK("20060901150001MH", allequal_uint4( res.quot, x0q_v ) && allequal_uint4( res.rem, x0r_v ), 0); res = divu4(x1n_v, x1d_v); TEST_CHECK("20060901150002MH", allequal_uint4( res.quot, x1q_v ) && allequal_uint4( res.rem, x1r_v ), 0); res = divu4(x2n_v, x2d_v); TEST_CHECK("20060901150003MH", allequal_uint4( res.quot, x2q_v ) && allequal_uint4( res.rem, x2r_v ), 0); res = divu4(x3n_v, x3d_v); TEST_CHECK("20060901150004MH", allequal_uint4( res.quot, x3q_v ) && allequal_uint4( res.rem, x3r_v ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20040928184342EJL","EJL", "fminf4_fmaxf4"); float x0min = hide_float(1760.135f); float x0max = hide_float(19355.03f); float x1min = hide_float(-12351.9f); float x1max = hide_float(-139.035f); float x2min = hide_float(-1.0); float x2max = hide_float(0.0); vec_float4 x0min_v = spu_splats(x0min); vec_float4 x0max_v = spu_splats(x0max); vec_float4 x1min_v = spu_splats(x1min); vec_float4 x1max_v = spu_splats(x1max); vec_float4 x2min_v = spu_splats(x2min); vec_float4 x2max_v = spu_splats(x2max); float res; vec_float4 res_v; TEST_START("fminf4"); res_v = fminf4(x0min_v, x0max_v); TEST_CHECK("20040928184345EJL", allequal_float4( res_v, x0min_v ), 0); res_v = fminf4(x0max_v, x0min_v); TEST_CHECK("20040928184349EJL", allequal_float4( res_v, x0min_v ), 0); res_v = fminf4(x1min_v, x1max_v); TEST_CHECK("20040928184351EJL", allequal_float4( res_v, x1min_v ), 0); res_v = fminf4(x1max_v, x1min_v); TEST_CHECK("20040928184353EJL", allequal_float4( res_v, x1min_v ), 0); res_v = fminf4(x2min_v, x2max_v); TEST_CHECK("20040928184354EJL", allequal_float4( res_v, x2min_v ), 0); res_v = fminf4(x2max_v, x2min_v); TEST_CHECK("20040928184356EJL", allequal_float4( res_v, x2min_v ), 0); TEST_START("fminf"); res = fminf(x0min, x0max); TEST_CHECK("20040928184358EJL", res == x0min, 0); res = fminf(x0max, x0min); TEST_CHECK("20040928184400EJL", res == x0min, 0); res = fminf(x1min, x1max); TEST_CHECK("20040928184401EJL", res == x1min, 0); res = fminf(x1max, x1min); TEST_CHECK("20040928184403EJL", res == x1min, 0); res = fminf(x2min, x2max); TEST_CHECK("20040928184405EJL", res == x2min, 0); res = fminf(x2max, x2min); TEST_CHECK("20040928184406EJL", res == x2min, 0); TEST_START("fmaxf4"); res_v = fmaxf4(x0min_v, x0max_v); TEST_CHECK("20040928184411EJL", allequal_float4( res_v, x0max_v ), 0); res_v = fmaxf4(x0max_v, x0min_v); TEST_CHECK("20040928184413EJL", allequal_float4( res_v, x0max_v ), 0); res_v = fmaxf4(x1min_v, x1max_v); TEST_CHECK("20040928184415EJL", allequal_float4( res_v, x1max_v ), 0); res_v = fmaxf4(x1max_v, x1min_v); TEST_CHECK("20040928184416EJL", allequal_float4( res_v, x1max_v ), 0); res_v = fmaxf4(x2min_v, x2max_v); TEST_CHECK("20040928184417EJL", allequal_float4( res_v, x2max_v ), 0); res_v = fmaxf4(x2max_v, x2min_v); TEST_CHECK("20040928184419EJL", allequal_float4( res_v, x2max_v ), 0); TEST_START("fmaxf"); res = fmaxf(x0min, x0max); TEST_CHECK("20040928184420EJL", res == x0max, 0); res = fmaxf(x0max, x0min); TEST_CHECK("20040928184422EJL", res == x0max, 0); res = fmaxf(x1min, x1max); TEST_CHECK("20040928184423EJL", res == x1max, 0); res = fmaxf(x1max, x1min); TEST_CHECK("20040928184424EJL", res == x1max, 0); res = fmaxf(x2min, x2max); TEST_CHECK("20040928184426EJL", res == x2max, 0); res = fmaxf(x2max, x2min); TEST_CHECK("20040928184428EJL", res == x2max, 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20060904200000MH","MH", "lldivu2"); unsigned long long x0n = 0x0c0e84c75f216c43ull; unsigned long long x0d = 0x00000000000abcdeull; unsigned long long x0q = 0x0000011f71fb04cbull; unsigned long long x0r = 0x0000000000003039ull; unsigned long long x1n = 0x0c0e84c75f216c43ull; unsigned long long x1d = 0x0000011f71fb04cbull; unsigned long long x1q = 0x00000000000abcdeull; unsigned long long x1r = 0x0000000000003039ull; unsigned long long x2n = 0x08e732f9d4baf903ull; unsigned long long x2d = 0x0000000000976bb6ull; unsigned long long x2q = 0x0000000f0d55f4d9ull; unsigned long long x2r = 0x00000000004933bdull; unsigned long long x3n = 0x08e732f9d4baf903ull; unsigned long long x3d = 0x0000000f0d55f4d9ull; unsigned long long x3q = 0x0000000000976bb6ull; unsigned long long x3r = 0x00000000004933bdull; unsigned long long x4n = 0xffffffffffffffffull; unsigned long long x4d = 0xfffffffffffffffeull; unsigned long long x4q = 0x0000000000000001ull; unsigned long long x4r = 0x0000000000000001ull; unsigned long long x5n = 0xffffffffffffffffull; unsigned long long x5d = 0x0000000000000001ull; unsigned long long x5q = 0xffffffffffffffffull; unsigned long long x5r = 0x0000000000000000ull; unsigned long long x6n = 0xffffffffffffffffull; unsigned long long x6d = 0x0000000000000002ull; unsigned long long x6q = 0x7fffffffffffffffull; unsigned long long x6r = 0x0000000000000001ull; unsigned long long x7n = 0xffffffffffffffffull; unsigned long long x7d = 0x7fffffffffffffffull; unsigned long long x7q = 0x0000000000000002ull; unsigned long long x7r = 0x0000000000000001ull; unsigned long long x8n = 0xf8c0d45d0ff344f0ull; unsigned long long x8d = 0x000019aa3e41e0bdull; unsigned long long x8q = 0x000000000009b13bull; unsigned long long x8r = 0x000004c443bccc61ull; unsigned long long x9n = 0xf8c0d45d0ff344f0ull; unsigned long long x9d = 0x000000000009b13bull; unsigned long long x9q = 0x000019aa3ebfc739ull; unsigned long long x9r = 0x000000000000f1cdull; vec_ullong2 x0n_v = (vec_ullong2){ x0n, x1n }; vec_ullong2 x0d_v = (vec_ullong2){ x0d, x1d }; vec_ullong2 x0q_v = (vec_ullong2){ x0q, x1q }; vec_ullong2 x0r_v = (vec_ullong2){ x0r, x1r }; vec_ullong2 x1n_v = (vec_ullong2){ x2n, x3n }; vec_ullong2 x1d_v = (vec_ullong2){ x2d, x3d }; vec_ullong2 x1q_v = (vec_ullong2){ x2q, x3q }; vec_ullong2 x1r_v = (vec_ullong2){ x2r, x3r }; vec_ullong2 x2n_v = (vec_ullong2){ x4n, x5n }; vec_ullong2 x2d_v = (vec_ullong2){ x4d, x5d }; vec_ullong2 x2q_v = (vec_ullong2){ x4q, x5q }; vec_ullong2 x2r_v = (vec_ullong2){ x4r, x5r }; vec_ullong2 x3n_v = (vec_ullong2){ x6n, x7n }; vec_ullong2 x3d_v = (vec_ullong2){ x6d, x7d }; vec_ullong2 x3q_v = (vec_ullong2){ x6q, x7q }; vec_ullong2 x3r_v = (vec_ullong2){ x6r, x7r }; vec_ullong2 x4n_v = (vec_ullong2){ x8n, x9n }; vec_ullong2 x4d_v = (vec_ullong2){ x8d, x9d }; vec_ullong2 x4q_v = (vec_ullong2){ x8q, x9q }; vec_ullong2 x4r_v = (vec_ullong2){ x8r, x9r }; lldivu2_t res; TEST_START("lldivu2"); res = lldivu2(x0n_v, x0d_v); TEST_CHECK("20060904200001MH", allequal_ullong2( res.quot, x0q_v ) && allequal_ullong2( res.rem, x0r_v ), 0); res = lldivu2(x1n_v, x1d_v); TEST_CHECK("20060904200002MH", allequal_ullong2( res.quot, x1q_v ) && allequal_ullong2( res.rem, x1r_v ), 0); res = lldivu2(x2n_v, x2d_v); TEST_CHECK("20060904200003MH", allequal_ullong2( res.quot, x2q_v ) && allequal_ullong2( res.rem, x2r_v ), 0); res = lldivu2(x3n_v, x3d_v); TEST_CHECK("20060904200004MH", allequal_ullong2( res.quot, x3q_v ) && allequal_ullong2( res.rem, x3r_v ), 0); res = lldivu2(x4n_v, x4d_v); TEST_CHECK("20060904200005MH", allequal_ullong2( res.quot, x4q_v ) && allequal_ullong2( res.rem, x4r_v ), 0); TEST_SET_DONE(); TEST_EXIT(); }
~counted_type() { TEST_CHECK(--count >= 0); }