MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / main

Function main

tests/test_connection.cpp:1561–1669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1559}
1560
1561int main( int argc, const char **argv )
1562{
1563 typedef void (*FnTest)(void);
1564 struct Test_t {
1565 const char *m_pszName;
1566 FnTest m_func;
1567 };
1568
1569 #define TEST(x) { #x, Test_ ## x }
1570
1571 static const Test_t tests[] = {
1572 TEST(identity),
1573 TEST(quick),
1574 TEST(soak),
1575 TEST(netloopback_throughput),
1576 TEST(lane_quick_queueanddrain),
1577 TEST(lane_quick_priority_and_background),
1578 TEST(pipe),
1579 TEST(send_buffer_full),
1580 TEST(recv_buf_full)
1581 };
1582
1583 struct Suite_t {
1584 const char *m_pszName;
1585 std::vector< Test_t > m_vecTests;
1586 };
1587 static const Suite_t test_suites[] = {
1588 { "suite-quick", { TEST(identity), TEST(quick), TEST(lane_quick_queueanddrain), TEST(lane_quick_priority_and_background), TEST(pipe), TEST(send_buffer_full), TEST(recv_buf_full) } }
1589 };
1590
1591 if ( argc < 2 )
1592 {
1593print_usage:
1594 {
1595 const char *prog = argv[0];
1596 while ( strchr( prog, '/' ) )
1597 prog = strchr( prog, '/' ) + 1;
1598 while ( strchr( prog, '\\' ) )
1599 prog = strchr( prog, '\\' ) + 1;
1600 printf( "Usage: %s test-or-suite-name ...\n", prog );
1601 }
1602print_available_tests_and_exit:
1603 printf( "\n" );
1604 printf( "Available tests:\n" );
1605 for ( const Test_t &t: tests )
1606 printf( " %s\n", t.m_pszName );
1607 printf( "Available test suites:\n" );
1608 for ( const Suite_t &s: test_suites )
1609 printf( " %s\n", s.m_pszName );
1610 return 1;
1611 }
1612
1613 std::vector<Test_t> vecTestsToRun;
1614 for ( int i = 1 ; i < argc ; ++i )
1615 {
1616 if ( !strcasecmp( argv[i], "/?" ) || !strcasecmp( argv[i], "-?" ) || !strcasecmp( argv[i], "/?" ) || !strcasecmp( argv[i], "-h" ) || !strcasecmp( argv[i], "--help" ) )
1617 goto print_usage;
1618

Callers 1

nnMainFunction · 0.70

Calls 5

TEST_InitFunction · 0.85
TEST_PrintfFunction · 0.85
ClearConfigFunction · 0.85
TEST_KillFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected