Ejemplo n.º 1
0
TEST(cases, format)
{
    msgpack::unpacker pac;
    msgpack::unpacker pac_compact;

    feed_file(pac, "cases.mpac");
    feed_file(pac_compact, "cases_compact.mpac");

    msgpack::object_handle oh;
    while(pac.next(&oh)) {
        msgpack::object_handle oh_compact;
        EXPECT_TRUE( pac_compact.next(&oh_compact) );
        EXPECT_EQ(oh_compact.get(), oh.get());
    }

    EXPECT_FALSE( pac_compact.next(&oh) );
}
Ejemplo n.º 2
0
TEST(cases, format)
{
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
    msgpack::unpacker pac;
    msgpack::unpacker pac_compact;

    feed_file(pac, "cases.mpac");
    feed_file(pac_compact, "cases_compact.mpac");

    msgpack::object_handle oh;
    while(pac.next(oh)) {
        msgpack::object_handle oh_compact;
        EXPECT_TRUE( pac_compact.next(oh_compact) );
        EXPECT_EQ(oh_compact.get(), oh.get());
    }

    EXPECT_FALSE( pac_compact.next(oh) );
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
}
Ejemplo n.º 3
0
int main( int argc, char **argv )
{
    NOT_USED(argc);
    NOT_USED(argv);

    assert( argc == 2 );


    parser_xml_t *xml = parser_xml_new( &print_cb, NULL );

    feed_file( strdup( argv[1] ), xml );

    parser_xml_delete( xml );


    return 0;
}
Ejemplo n.º 4
0
int main(int argc, char * argv[]){  
    char * outfilename = "temp.out";
    int phrase_index = 0;
    int i = 1;

    g_pinyin_tree = g_tree_new(phrase_item_compare);

    setlocale(LC_ALL,"");
    while (  i < argc ){
	if ( strcmp("--help", argv[i] ) == 0) {
		print_help();
                exit(0);
	}else if ( strcmp("-t", argv[i] ) == 0){
	    if ( ++i >= argc ) {
		print_help();
                exit(EINVAL);
            }
	    phrase_index = atoi(argv[i]);
	}else if ( strcmp("-o", argv[i] ) == 0 ){
	    if ( ++i >= argc ) {
		print_help();
                exit(EINVAL);
            }
	    outfilename = g_strdup(argv[i]);
	} else {
	    feed_file(argv[i]);
	}
	++i;
    }
    
    printf("nnodes: %d\n", g_tree_nnodes(g_pinyin_tree));

    store_in_item_array();
    sort_item_array();
    gen_phrase_file(outfilename, phrase_index);

    return 0;
}