TEST(test_encode_decode, test_string) { test_string("", "00"); test_string("testing", "0774657374696e67"); test_string("One small step for Kerbal-kind!", "1f4f6e6520736d616c6c207374657020666f72204b657262616c2d6b696e6421"); test_string(krpc::platform::unhexlify("e284a2"), "03e284a2"); test_string("Mystery Goo" + krpc::platform::unhexlify("e284a2") + " Containment Unit", "1f4d79737465727920476f6fe284a220436f6e7461696e6d656e7420556e6974"); }
int main() { int return_flag = 0; std::string str_1("N->N2"); std::vector<std::string> test_1_split_exact(2); test_1_split_exact[0] = std::string("N"); test_1_split_exact[1] = std::string("N2"); std::vector<std::string> str_1_split; GRINS::StringUtilities::split_string( str_1, "->", str_1_split); if( !test_string( str_1_split, test_1_split_exact ) ) return_flag = 1; std::string str_2("N+C(s)->CN"); std::vector<std::string> test_2_split_exact(2); test_2_split_exact[0] = std::string("N+C(s)"); test_2_split_exact[1] = std::string("CN"); std::vector<std::string> str_2_split; GRINS::StringUtilities::split_string( str_2, "->", str_2_split); if( !test_string( str_2_split, test_2_split_exact ) ) return_flag = 1; std::string str_3("u:v:w:T:p:w_N:w_N2:p0"); std::vector<std::string> test_3_split_exact(8); test_3_split_exact[0] = std::string("u"); test_3_split_exact[1] = std::string("v"); test_3_split_exact[2] = std::string("w"); test_3_split_exact[3] = std::string("T"); test_3_split_exact[4] = std::string("p"); test_3_split_exact[5] = std::string("w_N"); test_3_split_exact[6] = std::string("w_N2"); test_3_split_exact[7] = std::string("p0"); std::vector<std::string> str_3_split; GRINS::StringUtilities::split_string( str_3, ":", str_3_split); if( !test_string( str_3_split, test_3_split_exact ) ) return_flag = 1; std::string str_4("u v w T p w_N w_N2 p0"); std::vector<std::string> test_4_split_exact(8); test_4_split_exact[0] = std::string("u"); test_4_split_exact[1] = std::string("v"); test_4_split_exact[2] = std::string("w"); test_4_split_exact[3] = std::string("T"); test_4_split_exact[4] = std::string("p"); test_4_split_exact[5] = std::string("w_N"); test_4_split_exact[6] = std::string("w_N2"); test_4_split_exact[7] = std::string("p0"); std::vector<std::string> str_4_split; GRINS::StringUtilities::split_string( str_4, " ", str_4_split); if( !test_string( str_4_split, test_4_split_exact ) ) return_flag = 1; return return_flag; }
void qstrings() { QString s; s.toLatin1().data(); // OK, list isn't shared test_string().first(); // Warning test_const_string().first(); // OK test_const_string_ref().first(); // OK test_const_string_ptr()->first(); // OK test_string().first(); // Warning test_string_ref().first(); // Warning test_string_ptr()->first(); // OK }
static const char * test_repeated_multibyte_char(const char *repeat_startp, const char *stringp, const char *regexp) { const char *end_of_matchp; end_of_matchp = test_string(stringp, regexp); while ((end_of_matchp == (char *)0) && (stringp > repeat_startp)) { stringp = previous_charp(stringp); end_of_matchp = test_string(stringp, regexp); } return (end_of_matchp); }
static const char * test_repeated_ascii_char(const char *repeat_startp, const char *stringp, const char *regexp) { const char *end_of_matchp; end_of_matchp = test_string(stringp, regexp); while ((end_of_matchp == (char *)0) && (stringp > repeat_startp)) { stringp--; end_of_matchp = test_string(stringp, regexp); } return (end_of_matchp); }
int main (int argc, char *argv[]) { if (argc < 2) { printf("Usage %s <string to encode>\n", argv[0]); return (1); } if ((test_sizes()) != 0) { return (1); } if ((test_string(argv[1], strlen(argv[1]))) != 0) { return (1); } if (test_uuid() != 0) { return (1); } if (test_random() != 0) { return (1); } return (0); }
void BasicCase_tests::MyTest() { float fnum = 2.00001f; // CPPUNIT_FAIL("zxczc"); CPPUNIT_ASSERT_DOUBLES_EQUAL( fnum, 2.0f, 0.0005 ); std::string pattern_string("%%d pattern"); std::string test_string("test pattern"); std::string replace_string("test"); TROOT troot("TreeAnalysis","compiled analysisDST macros"); TApplication app(); TVector3 vec_res; // test pvr->clear(); pvr->insert_track(gen_track(0, 0, 0, 0, 0, 10, 10)); pvr->insert_track(gen_track(0, 0, 0, 0, 10, 0, 10)); vec_res = pvr->calc(); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.X(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Y(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Z(), 0.0005 ); // test pvr->clear(); pvr->insert_track(gen_track(0, 0, 0, 0, 0, 10, 10)); pvr->insert_track(gen_track(0, 0, 0, 10, 0, 0, 10)); vec_res = pvr->calc(); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.X(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Y(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Z(), 0.0005 ); // test pvr->clear(); pvr->insert_track(gen_track(0, 0, 0, 0, 0, 10, 10)); pvr->insert_track(gen_track(0, 0, 10, 10, 0, 0, 10)); vec_res = pvr->calc(); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.X(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Y(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, vec_res.Z(), 0.0005 ); // test pvr->clear(); pvr->insert_track(gen_track(0, 0, -15, 10, 0, 0, 10)); pvr->insert_track(gen_track(0, 0, 5, 0, -10, 0, 10)); vec_res = pvr->calc(); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.X(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Y(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( -5, vec_res.Z(), 0.0005 ); // test pvr->clear(); pvr->insert_track(gen_track(0, 0, -15, 10, 0, 0, 10)); pvr->insert_track(gen_track(0, 0, 5, 0, -10, 0, 10)); pvr->insert_track(gen_track(0, 0, -5, -10, 0, 0, 10)); vec_res = pvr->calc(); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.X(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, vec_res.Y(), 0.0005 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( -5, vec_res.Z(), 0.0005 ); }
int TestApp::main(const std::vector<std::string> &args) { // Create a console window for text-output if not available ConsoleWindow console("Console"); try { Console::write_line("ClanLib Test Suite:"); Console::write_line("-------------------"); #ifdef WIN32 Console::write_line("Target: WIN32"); #else Console::write_line("Target: LINUX"); #endif Console::write_line("Directory: API/Core/Text"); str = "hello!"; Console::write_line(" - %1", test_stringref()); test_string(); Console::write_line("All Tests Complete"); console.display_close_message(); } catch(Exception error) { Console::write_line("Exception caught:"); Console::write_line(error.message); console.display_close_message(); return -1; } return 0; }
int main(int argc, char ** argv) { if (argc != 3) { fprintf(stderr, "Usage: %s PROG FILE\n", argv[0]); exit(-1); } prog = argv[1]; file = argv[2]; oldout = dup(STDOUT_FILENO); pipe(p_out); dup2(p_out[1], STDOUT_FILENO); pipe(p_err); dup2(p_err[1], STDERR_FILENO); poll_out.fd = p_out[0]; poll_out.events = POLLIN; memset(filling, 'a', PIPEMAX); char input[MAXINPUT] = {0}; int size; unsigned char c; for (size = 2; c < CHAR_END && size < MAXINPUT; size++) { // fill in extra char to make sure we'll fail input[size - 1] = -1; for (c = CHAR_START; c < CHAR_END; c++) { input[size - 2] = c; if (test_string(size, input)) { break; } } } // make it print the pwd to stdout input[size-3] = '\0'; dup2(oldout, STDERR_FILENO); execl(prog, prog, file, input, NULL); }
int main (int argc, char **argv) { int fails = 0; fails += test_string(); return fails ? 1 : 0; }
void Test_Variant::run() { test_int(); test_float(); test_double(); test_string(); }
int main(void) { JsonNode *node; (void) chomp; plan_tests(49); ok1(json_find_element(NULL, 0) == NULL); ok1(json_find_member(NULL, "") == NULL); ok1(json_first_child(NULL) == NULL); node = json_mknull(); should_be(node, "null"); json_delete(node); node = json_mkbool(false); should_be(node, "false"); json_delete(node); node = json_mkbool(true); should_be(node, "true"); json_delete(node); test_string(); test_number(); test_array(); test_object(); return exit_status(); }
int main() { test_string(); test_string_hash_set(); test_string_map(); return 0; }
int main(int args, char **argv) { JNX_LOG(NULL,"Running test for jnxguid"); test_generate_guid(); test_compare_guid(); test_string(); return 0; }
void testSubscriptOperator() { getList()[0]; // Warning if (test_string()[0].isEmpty()) {} // Warning getMap()[0]; // Warning auto m = getMap(); m[0]; }
static VALUE MARC_test(VALUE self, VALUE str) { char *s; char t[100]; s = StringValuePtr(str); memcpy(t, test_string(s), 99); return rb_str_new2(t); }
int main () { test_string (); test_null_string (); test_int (); return 0; }
bool JsonIn::read(std::string &s) { if (!test_string()) { return false; } s = get_string(); return true; }
int test_jnxguid() { JNXLOG(LDEBUG,"Running test for jnxguid"); test_generate_guid(); test_compare_guid(); test_string(); return 0; }
int main(int argc, char * argv[]) { test_int(); test_string(); return EXIT_SUCCESS; }
static void test_github_issue_42(void) { // Verify we are not dependent on locale, Turkish-i problem in particular. if (setlocale(LC_CTYPE, "tr_TR.UTF-8") == NULL) { // The locale is not available, probably; skip. return; } assert(test_string("i", XKB_KEY_i)); assert(test_string("I", XKB_KEY_I)); assert(test_casestring("i", XKB_KEY_i)); assert(test_casestring("I", XKB_KEY_i)); assert(xkb_keysym_to_upper(XKB_KEY_i) == XKB_KEY_I); assert(xkb_keysym_to_lower(XKB_KEY_I) == XKB_KEY_i); setlocale(LC_CTYPE, "C"); }
static const char * test_repeated_group(const char *repeat_startp, const char *stringp, const char *regexp) { const char *end_of_matchp; end_of_matchp = test_string(stringp, regexp); while ((end_of_matchp == (char *)0) && (stringp > repeat_startp)) { stringp = pop_stringp(); if (stringp == (char *)0) { return ((char *)0); } end_of_matchp = test_string(stringp, regexp); } return (end_of_matchp); }
int main(int argc, char **argv) { test_string(); test_list(); test_map(); test_map_stack(); test_dict(); printf("Passed\n"); return 0; }
int main (int argc, char **argv) { test_quotes(); test_string(); test_varlen_seps(); test_same_quote(); test_vector_init(); return 0; }
int main() { test_one_int(); test_string(); test_checker(); test_alignment(); test_zero_allocation(); test_deallocation(); std::cout << "Tests passed!" << std::endl; }
int main(int argc, char *argv[]) { (void) argc; (void) argv; test_buffered(); test_unbuffered(); test_string(); return 0; }
int main (void) { res=0; #if defined __MINILIB_TEST__ res = test_ctype(); res = test_stdio(); res = test_stdlib(); res = test_string(); #endif for (;;); }
void t_zcl_type_name( void) { char error[40]; int i; for (i = 0; i < 256; ++i) { sprintf( error, "Wrong name for type 0x%02X", i); test_string( zcl_type_name( i), expected_name[i], error); } }
int main() { test_single_functions(); test_decimal(123); test_decimal(-123); test_unsigned(); test_hex(); test_narrow(); test_string(); return 0; }
int main () { gdouble d; char buffer[G_ASCII_DTOSTR_BUF_SIZE]; test_string ("123.123", 123.123); test_string ("123.123e2", 123.123e2); test_string ("123.123e-2", 123.123e-2); test_string ("-123.123", -123.123); test_string ("-123.123e2", -123.123e2); test_string ("-123.123e-2", -123.123e-2); d = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0; g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL)); d = -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0; g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL)); d = pow (2.0, -1024.1); g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL)); d = -pow (2.0, -1024.1); g_assert (d == g_ascii_strtod (g_ascii_dtostr (buffer, sizeof (buffer), d), NULL)); return 0; }