Exemple #1
0
int main()
#endif
{
#if RUN_TEST_LOOP
	for(;;)
#endif
	{
		tnet_startup();

		/* Print copyright information */
		printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n");
	
#if RUN_TEST_ALL  || RUN_TEST_URI
		test_uri();
#endif

#if RUN_TEST_ALL  || RUN_TEST_PARSER
		test_parser();
#endif

#if RUN_TEST_ALL  || RUN_TEST_SESSION
		test_session();
#endif

		tnet_cleanup();
	}
}
Exemple #2
0
TEST(ioJson,jsonParserO12) {
  test_parser("{  \"foo\" : { \"bar\": 1, \"baz\": 2 } }   ",
              "S:text" "S:obj" "KEY:\"foo\"" "S:obj" 
              "KEY:\"bar\""  "UL(INT):1" 
              "KEY:\"baz\""  "UL(INT):2" 
              "E:obj" "E:obj" "E:text");
}
Exemple #3
0
TEST(ioJson,jsonParserA8) {
  test_parser("[ [ -1, -2 ],[ 1, 2 ] ]",
              "S:text" "S:arr" 
              "S:arr" "L(INT):-1" "L(INT):-2"  "E:arr"
              "S:arr" "UL(INT):1" "UL(INT):2"  "E:arr"
              "E:arr" "E:text");
}
Exemple #4
0
TEST(ioJson,jsonParserO14) {
  test_parser("{  \"foo\" : [ { \"bar\": { \"baz\": [ 1, 2]  } }, -3, -4.44 ] }  ",
              "S:text" "S:obj" "KEY:\"foo\"" "S:arr" "S:obj" 
              "KEY:\"bar\""  "S:obj" "KEY:\"baz\""  
              "S:arr" "UL(INT):1" "UL(INT):2" "E:arr" "E:obj" "E:obj" 
              "L(INT):-3" "D(REAL):-4.44" "E:arr" "E:obj" "E:text");
}
Exemple #5
0
int main(int argc, char** argv)
{
    vm_init();

    // Test mode
    if (argc == 2 && strcmp(argv[1], "--test") == 0)
    {
        test_vm();
        test_parser();
        test_interp();
        return 0;
    }

    // File name passed
    if (argc == 2)
    {
        char* cstr = read_file(argv[1]);

        if (cstr == NULL)
            return -1;

        // Evaluate the code string
        eval_str(cstr);

        free(cstr);
    }

    // No file names passed. Read-eval-print loop.
    if (argc == 1)
    {
        run_repl();
    }

    return 0;
}
Exemple #6
0
TEST(ioJson,jsonParserO13) {
  test_parser("{  \"foo\" : { \"bar\": { \"baz\": [ 1, 2]  } } }  ",
              "S:text" "S:obj" "KEY:\"foo\"" "S:obj" 
              "KEY:\"bar\""  "S:obj" "KEY:\"baz\""  
              "S:arr" "UL(INT):1" "UL(INT):2" "E:arr" 
              "E:obj" "E:obj" "E:obj" "E:text");
}
Exemple #7
0
int main(int argc, const char * const *argv)
{
	// if VALGRIND testing is enabled, we have to call ourselves with valgrind checking
	const char *valgrind = getenv("VALGRIND_TESTS");

	if (!valgrind || !*valgrind || !strcmp(valgrind, "0")) {
		// fallthrough
	}
	else if (!strcmp(valgrind, "1")) {
		char cmd[strlen(argv[0]) + 256];

		snprintf(cmd, sizeof(cmd), "VALGRIND_TESTS=\"\" valgrind --error-exitcode=301 --leak-check=yes --show-reachable=yes --track-origins=yes %s", argv[0]);
		return system(cmd) != 0;
	} else {
		char cmd[strlen(valgrind) + strlen(argv[0]) + 32];

		snprintf(cmd, sizeof(cmd), "VALGRIND_TESTS="" %s %s", valgrind, argv[0]);
		return system(cmd) != 0;
	}

	init(argc, argv); // allows us to test with options (e.g. with --debug)

	srand((unsigned int) time(NULL));

	// testing basic library functionality
	test_buffer();
	test_buffer_printf();
	test_utils();
	test_strcasecmp_ascii();
	test_vector();
	test_stringmap();

	if (failed) {
		info_printf("ERROR: %d out of %d basic tests failed\n", failed, ok + failed);
		info_printf("This may completely break Mget functionality !!!\n");
		return 1;
	}

	test_iri_parse();
	test_iri_relative_to_absolute();
	test_iri_compare();
	test_parser();

	test_cookies();
	test_hsts();
	test_parse_challenge();

	selftest_options() ? failed++ : ok++;

	deinit(); // free resources allocated by init()

	if (failed) {
		info_printf("Summary: %d out of %d tests failed\n", failed, ok + failed);
		return 1;
	}

	info_printf("Summary: All %d tests passed\n", ok + failed);
	return 0;
}
Exemple #8
0
TEST(ioJson,jsonParserA6) {
  std::stringstream textReport;
  textReport << "S:text" << "S:arr" << "D(REAL):" 
             << -0.10001900
             << "E:arr" << "E:text";
  test_parser("[ -0.10001900 ]",
              textReport.str());
}
Exemple #9
0
TEST(ioJson,jsonParserO5) {
  std::stringstream textReport;
  textReport << "S:text" << "S:obj" << "KEY:\"foo\"" << "D(REAL):" 
             << -0.10001900
             << "E:obj" << "E:text";
  test_parser("{ \"foo\": -0.10001900 }",
              textReport.str());
}
Exemple #10
0
TEST(ioJson,jsonParserO7) {
  std::stringstream textReport;
  textReport << "S:text" << "S:obj" << "KEY:\"foo\"" 
             << "D(REAL):" 
             << -1.0100e09
             << "E:obj" << "E:text";
  test_parser("{ \"foo\": -1.0100e09 }",
              textReport.str());
}
Exemple #11
0
TEST(ioJson,jsonParserA9) {
  test_parser("[ [ [1, 2 ],[ 3, 4 ] ],[ [5, 6 ],[ 7, 8 ] ] ]",
              "S:text" "S:arr" "S:arr"
              "S:arr" "UL(INT):1" "UL(INT):2"  "E:arr"
              "S:arr" "UL(INT):3" "UL(INT):4"  "E:arr"
              "E:arr" "S:arr"
              "S:arr" "UL(INT):5" "UL(INT):6"  "E:arr"
              "S:arr" "UL(INT):7" "UL(INT):8"  "E:arr"
              "E:arr" "E:arr" "E:text");
}
void
test_patterndb_parsers()
{
  gint i;

  for (i = 0; parsers[i]; i++)
    {
      test_parser(parsers[i]);
    }
}
Exemple #13
0
int main(int argc, char *argv[]) {
    srand(time(NULL));

    if (argc > 1 && strcmp(argv[1], "test") == 0) {
            test_parser();
    }

    launch_menu();

    return 0;
}
Exemple #14
0
TEST(ioJson,jsonParserO4) {
  std::stringstream textReport;
  textReport << "S:text" << "S:obj" 
             << "KEY:\"foo\"" << "UL(INT):1"
             << "KEY:\"baz\"" 
             << "S:arr" << "UL(INT):2" << "UL(INT):3" << "D(REAL):" 
             << 4.01001 
             << "E:arr" 
             << "E:obj" << "E:text";
  test_parser("{ \"foo\" : 1, \n \"baz\" : [ 2, 3, 4.01001 ] };",
              textReport.str());
}
Exemple #15
0
int main(int argc, char *argv[]) {
    _cleanup_(sd_event_unrefp) sd_event *e = NULL;

    test_parser();

    /* LLDP reception tests */
    assert_se(sd_event_new(&e) == 0);
    test_receive_basic_packet(e);
    test_receive_incomplete_packet(e);
    test_receive_oui_packet(e);

    return 0;
}
Exemple #16
0
/**
   Main test 
*/
int main( int argc, char **argv )
{
	setlocale( LC_ALL, "" );
	srand( time( 0 ) );

	program_name=L"(ignore)";
	
	say( L"Testing low-level functionality");
	say( L"Lines beginning with '(ignore):' are not errors, they are warning messages\ngenerated by the fish parser library when given broken input, and can be\nignored. All actual errors begin with 'Error:'." );

	proc_init();	
	halloc_util_init();
	event_init();	
	parser_init();
	function_init();
	builtin_init();
	reader_init();
	env_init();

	test_util();
	test_escape();
	test_convert();
	test_tok();
	test_parser();
	test_expand();
	test_path();
	
	say( L"Encountered %d errors in low-level tests", err_count );

	/*
	  Skip performance tests for now, since they seem to hang when running from inside make (?)
	*/
//	say( L"Testing performance" );
//	perf_complete();
		
	env_destroy();
	reader_destroy();	
	parser_destroy();
	function_destroy();
	builtin_destroy();
	wutil_destroy();
	event_destroy();
	proc_destroy();
	halloc_util_destroy();
	
}
Exemple #17
0
int main(int argc, const char* argv[]) {

	std::cout << std::endl;

	test_parser();
	//test_semantic_analysis();
	test_inter_code_gen_visitor();
	test_asm_code_generator();
	test_asm_instruction();
	test_ir_parser();
	test_asm_parser();

	test_semantics_of_test_cases();

	std::cout << std::endl;

    return 0;
}
Exemple #18
0
int main()
#endif
{
	do
	{
		/* Print copyright information */
		printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n");
	
#if RUN_TEST_ALL  || RUN_TEST_PARSER
		test_parser();
#endif

#if RUN_TEST_ALL  || RUN_TEST_SOA
		test_soa();
#endif

#if RUN_TEST_ALL  || RUN_TEST_RFC5939
		test_rfc5939();
#endif

	} while(RUN_TEST_LOOP);
}
Exemple #19
0
Fichier : test.c Projet : gicho/sst
int main(void) {
    printf("Testing MPD... ");
    test_mpd();
    puts("passed");

    printf("Testing addition... ");
    test_add();
    puts("passed");

    printf("Testing SSlice... ");
    test_sslice();
    puts("passed");

    puts("Testing lexer...");
    test_lexer();
    puts("passed");

    puts("Testing parser...");
    test_parser();
    puts("passed");

    return EXIT_SUCCESS;
}
Exemple #20
0
TEST(ioJson,jsonParserA2) {
  test_parser("[5,10]",
              "S:text" "S:arr" "UL(INT):5" "UL(INT):10" "E:arr" "E:text");
}
Exemple #21
0
TEST(ioJson,jsonParserA3) {
  test_parser("[]",
              "S:text" "S:arr" "E:arr" "E:text");
}
Exemple #22
0
TEST(ioJson,jsonParserA0) {
  test_parser("[0]",
              "S:text" "S:arr" "UL(INT):0" "E:arr" "E:text");
}
Exemple #23
0
TEST(ioJson,jsonParserA1) {
  test_parser("[5]",
              "S:text" "S:arr" "UL(INT):5" "E:arr" "E:text");
}
Exemple #24
0
// surrogate pair boundary conditions
TEST(ioJson,jsonParserStr16) {
  test_parser("[ \"\\uDBFF\\uDC00\" ]",
              "S:text" "S:arr" "STR:\"\xf4\x8f\xb0\x80\"" "E:arr" "E:text");
}
Exemple #25
0
// surrogate pair boundary conditions
TEST(ioJson,jsonParserStr17) {
  test_parser("[ \"a\\uE000\" ]",
              "S:text" "S:arr" "STR:\"a\xEE\x80\x80\"" "E:arr" "E:text");
}
Exemple #26
0
// surrogate pair boundary conditions
TEST(ioJson,jsonParserStr15) {
  test_parser("[ \"\\uD800\\uDFFF\" ]",
              "S:text" "S:arr" "STR:\"\xf0\x90\x8F\xBF\"" "E:arr" "E:text");
}
Exemple #27
0
// surrogate pair boundary conditions
TEST(ioJson,jsonParserStr14) {
  test_parser("[ \"\\uD800\\uDC00\" ]",
              "S:text" "S:arr" "STR:\"\xf0\x90\x80\x80\"" "E:arr" "E:text");
}
Exemple #28
0
// same string w/ non-ASCII chars not \u escaped (specified as hex byte values)
TEST(ioJson,jsonParserStr13) {
  test_parser("[ \"D\xc3\xa9j\xc3\xa0 vu\" ]",
              "S:text" "S:arr" "STR:\"D\xc3\xa9j\xc3\xa0 vu\"" "E:arr" "E:text");
}
Exemple #29
0
// surrogate pair for G clef character from extended multilingual plane:
// specified here using hex values for non-ASCII UTF-8 bytes 
TEST(ioJson,jsonParserStr11) {
  test_parser("[ \"\\uD834\\uDD1E\" ]",
              "S:text" "S:arr" "STR:\"\xf0\x9D\x84\x9E\"" "E:arr" "E:text");
}
Exemple #30
0
TEST(ioJson,jsonParserStr10) {
  test_parser("[ \"\\u0069\" ]",
              "S:text" "S:arr" "STR:\"i\"" "E:arr" "E:text");
}