예제 #1
0
int main ( int argc, const char **argv )
{
    int r = 1;
    if ( argc < 3 )
    {
        fprintf ( stderr, "usage:\n\t%s multicast_address multicast_service (interface)\n", argv[0] );
        fprintf ( stderr, "example:\n\t%s ff31::8000:1234 30001\n", argv[0] );
        exit ( 1 );
    }
    if ( us_testutil_start ( 4096, 4096, argc, argv ) )
    {
        const char *multicast_address = argv[1];
        const char *multicast_service = argv[2];
        const char *interface = "";
        if ( argc > 3 )
            interface = argv[3];
#if US_ENABLE_LOGGING
        us_logger_printer_start ( us_testutil_printer_stdout, us_testutil_printer_stderr );
#endif
        us_log_set_level ( US_LOG_LEVEL_DEBUG );
        us_log_info ( "Hello world from %s compiled on %s", __FILE__, __DATE__ );
        if ( us_example_mudp_rx ( multicast_address, multicast_service, interface ) )
            r = 0;
        us_log_info ( "Finishing %s", argv[0] );
        us_logger_finish();
        us_testutil_finish();
    }
    return r;
}
예제 #2
0
int main ( int argc, const char **argv )
{
    int r = 1;
    const char *protocol = "udp";
    const char *src_host = "";
    const char *src_port = "30000";
    const char *dest_host = "127.0.0.1";
    const char *dest_port = "10000";
    const char *osc_address = "/osc/version";
    const char *osc_typetags = "";
    const char **osc_values = 0;
    if ( argc > 1 )
        protocol = argv[1];
    if ( argc > 2 )
        src_host = argv[2];
    if ( argc > 3 )
        src_port = argv[3];
    if ( argc > 4 )
        dest_host = argv[4];
    if ( argc > 5 )
        dest_port = argv[5];
    if ( argc > 6 )
        osc_address = argv[6];
    if ( argc > 7 )
        osc_typetags = argv[7];
    if ( argc > 8 )
        osc_values = &argv[8];
    if ( us_testutil_start ( 8192, 8192, argc, argv ) )
    {
#if US_ENABLE_LOGGING
        us_logger_printer_start ( us_testutil_printer_stdout, us_testutil_printer_stderr );
#endif
# ifdef WIN32
        us_platform_init_winsock ();
# endif
        us_log_set_level ( US_LOG_LEVEL_DEBUG );
        if ( argc < 7 )
        {
            us_stderr->printf( us_stderr, "%s usage:\n\t%s [udp/tcp/tcpslip] [src host] [src port] [dest host] [dest port] [osc address] [osc typetags] {values...}\n", argv[0], argv[0] );
        }
        else
        {
            if (  us_tool_send_osc( protocol, src_host, src_port, dest_host, dest_port, osc_address, osc_typetags, osc_values ) )
                r=0;
        }
        us_logger_finish();
        us_testutil_finish();
    }
    return r;
}
int us_test_osc_dispatch_main( int argc, const char **argv )
{
    bool r = true;
    r = us_testutil_start( 81920, 8192, argc, argv );
    if ( r )
    {
#if US_ENABLE_LOGGING
        us_logger_printer_start( us_testutil_printer_stdout, us_testutil_printer_stderr );
#endif
        us_log_info( "Hello world from %s compiled on %s", __FILE__, __DATE__ );
        r &= us_test_osc_dispatch_test1();
        us_logger_finish();
        us_testutil_finish();
    }
    return r ? 0 : 1;
}
int us_test_packet_queue_main(int argc, const char **argv) {
    int r = 1;
    if (us_testutil_start(20480, 20480, argc, argv)) {
#if US_ENABLE_LOGGING
        us_logger_printer_start(us_testutil_printer_stdout, us_testutil_printer_stderr);
#endif
        us_log_set_level(US_LOG_LEVEL_DEBUG);
        us_log_info("Hello world from %s compiled on %s", __FILE__, __DATE__);
        if (us_test_packet_queue(us_testutil_sys_allocator))
            r = 0;
        us_log_info("Finishing us_test_packet_queue");
        us_logger_finish();
        us_testutil_finish();
    }
    return r;
}
예제 #5
0
int us_test_getopt_main( int argc, const char **argv )
{
    int r = 1;
    if ( us_testutil_start( 4096, 4096, argc, argv ) )
    {
#if US_ENABLE_LOGGING
        us_logger_printer_start( us_testutil_printer_stdout, us_testutil_printer_stderr );
#endif
        us_log_set_level( US_LOG_LEVEL_DEBUG );
        us_log_info( "Hello world from %s compiled on %s", __FILE__, __DATE__ );
        if ( us_test_getopt( argc, argv ) )
            r = 0;
        us_log_info( "Finishing us_test_getopt" );
        us_logger_finish();
        us_testutil_finish();
    }
    return r;
}
예제 #6
0
int us_test_trie_main(int argc, const char **argv) {
    int r = 1;
    if (us_testutil_start(8192, 8192, argc, argv)) {
#if US_ENABLE_LOGGING
        us_logger_printer_start(us_testutil_printer_stdout, us_testutil_printer_stderr);
#endif
        us_log_set_level(US_LOG_LEVEL_DEBUG);
        us_log_info("Hello world from %s compiled on %s", __FILE__, __DATE__);
        if (us_test_trie_1() && us_test_trie_2())
            r = 0;
        if (r != 0)
            us_log_error("Failed");
        us_log_info("Finishing %s", argv[0]);
        us_logger_finish();
        us_testutil_finish();
    }
    return r;
}
예제 #7
0
int us_test_allocator_main( int argc, const char **argv )
{
    int r = 1;
    if ( us_testutil_start( 2048, 2048, argc, argv ) )
    {
        char *b;
#if US_ENABLE_LOGGING
        us_logger_printer_start( us_testutil_printer_stdout, us_testutil_printer_stderr );
#endif
        us_log_set_level( US_LOG_LEVEL_DEBUG );
        us_log_info( "Hello world from %s compiled on %s", __FILE__, __DATE__ );
        b = (char *)us_testutil_sys_allocator->alloc( us_testutil_sys_allocator, 512, 1 );
        us_log_debug( "result from alloc of 512 bytes: %p", b );
        us_log_info( "Finishing us_test_allocator" );
        us_logger_finish();
        us_testutil_finish();
        r = 0;
    }
    return r;
}