Example #1
0
int main(int argc, const char * argv[])
{
    sput_start_testing();
    
    sput_enter_suite("Mutable string tests");
    sput_run_test(testMutableStringSingleAppend);
    sput_run_test(testMutableStringMutipleAppend);
    sput_leave_suite();
    
    sput_enter_suite("Synchronous request tests");
    sput_run_test(testSuccessfulGET);
    sput_run_test(testSuccessfulGETResend);
    sput_run_test(testFailedGET);
    sput_leave_suite();
    
    sput_enter_suite("Asynchronous request tests");
    sput_run_test(testSuccessfulGETAsync);
    sput_run_test(testCancelledGETAsync);
    sput_run_test(testFailedGETAsync);
    sput_leave_suite();
    
    sput_enter_suite("REST Client tests");
    sput_run_test(testClientRequestCount);
    sput_run_test(testClientRequestPoolSize);
    sput_run_test(testClientResendRequestFromCallback);
    sput_leave_suite();
    
    sput_finish_testing();
    
    return 0;
}
void testingActionQueue()	{

    sput_start_testing();

    sput_set_output_stream(NULL);

    sput_enter_suite("testCheckMem(): memory check");
    sput_run_test(testCheckMem);
    sput_leave_suite();


    sput_enter_suite("testPushToQueue(): Pushing to queue");
    sput_run_test(testPushToQueue);
    sput_leave_suite();

    sput_finish_testing();
}
Example #3
0
int main()
{
	sput_start_testing();
	sput_enter_suite("iface");
	sput_run_test(iface_test_new_unmanaged);
	sput_run_test(iface_test_new_managed);
	sput_leave_suite();
	sput_finish_testing();
	return sput_get_return_value();
}
Example #4
0
int main(__unused int argc, __unused char **argv)
{
  openlog("test_dummy", LOG_CONS | LOG_PERROR, LOG_DAEMON);
  sput_start_testing();
  sput_enter_suite("dummysuite"); /* optional */
  sput_run_test(sample);
  sput_leave_suite(); /* optional */
  sput_finish_testing();
  return sput_get_return_value();
}
void testLevelController()	{

    sput_start_testing();
    sput_set_output_stream(NULL);

    sput_enter_suite("testReadLevelSettingsFile(): Testing reading and processing level keywords");
    sput_run_test(testReadLevelSettingsFile);
    sput_leave_suite();


    sput_finish_testing();
}
void testEnemy()
{
    SCREEN_WIDTH_GLOBAL = 1000;
    SCREEN_HEIGHT_GLOBAL = 1000;
    sput_start_testing();
    sput_set_output_stream(NULL);
    
    sput_enter_suite("Test_createEnemy(): Creating valid enemies in enemy group");
    sput_run_test(Test_createEnemy);
    sput_leave_suite();
    
    sput_enter_suite("testInitialiseEnemy(): Creating valid initialised enemies");
    sput_run_test(testInitialiseEnemy);
    sput_leave_suite();
    
    sput_enter_suite("testEnemyMovement(): Moving an enemy");
    sput_run_test(testEnemyMovement);
    sput_leave_suite();
    
    sput_finish_testing();
}
Example #7
0
int main(int argc, char **argv)
{
  openlog(argv[0], LOG_CONS | LOG_PERROR, LOG_DAEMON);
  sput_start_testing();
  sput_enter_suite("dns_util"); /* optional */
  sput_run_test(check_test_strings);
  sput_run_test(check_test_ipv6);
  sput_leave_suite(); /* optional */
  sput_finish_testing();
  return sput_get_return_value();
  return 0;
}
void testingGameStructure()	{
    sput_start_testing();

    sput_set_output_stream(NULL);

    sput_enter_suite("testStartNextWave(): Testing wave management");
    sput_run_test(testStartNextWave);
    sput_leave_suite();

    sput_enter_suite("testClocks(): Testing Clock Data Structure");
    sput_run_test(testClocks);
    sput_leave_suite();

    sput_enter_suite("CreateGameTest(): Creation & Initialization");
    sput_run_test(CreateGameTest);
    sput_leave_suite();

    sput_enter_suite("TestGetAvailableMemory(): Current Memory Available");
    sput_run_test(TestGetAvailableMemory);
    sput_leave_suite();

    sput_enter_suite("TestAddMemory(): Adding Memory");
    sput_run_test(TestAddMemory);
    sput_leave_suite();

    sput_enter_suite("TestUseMemory(): Using More Memory");
    sput_run_test(TestUseMemory);
    sput_leave_suite();

    sput_finish_testing();
}
void testingGameStructure()	{
	sput_start_testing();
	
	sput_set_output_stream(NULL);

	sput_enter_suite("testlastAction(): Cooldown checking");
	sput_run_test(testlastAction);
	sput_leave_suite();
	
	sput_enter_suite("testSetLastAction(): Setting last action to current clock");
	sput_run_test(testSetLastAction);
	sput_leave_suite();

	sput_enter_suite("CreateGameTest(): Creation & Initialization");
	sput_run_test(CreateGameTest);
	sput_leave_suite();

	sput_enter_suite("TestGetAvailableMemory(): Current Memory Available");
	sput_run_test(TestGetAvailableMemory);
	sput_leave_suite();

	sput_enter_suite("TestAddMemory(): Adding Memory");
	sput_run_test(TestAddMemory);
	sput_leave_suite();

	sput_enter_suite("TestUseMemory(): Using More Memory");
	sput_run_test(TestUseMemory);
	sput_leave_suite();

	sput_finish_testing();
}
Example #10
0
int main(__unused int argc, __unused char **argv)
{
  setbuf(stdout, NULL); /* so that it's in sync with stderr when redirected */
  openlog(argv[0], LOG_CONS | LOG_PERROR, LOG_DAEMON);
  sput_start_testing();
  sput_enter_suite(argv[0]); /* optional */
  sput_run_test(test_hncp_multicast);
  sput_run_test(test_hncp_multicast_noaddr);
  sput_leave_suite(); /* optional */
  sput_finish_testing();
  return sput_get_return_value();

}
Example #11
0
int main(int argc, char **argv)
{
  setbuf(stdout, NULL); /* so that it's in sync with stderr when redirected */
  openlog("test_hncp_nio", LOG_CONS | LOG_PERROR, LOG_DAEMON);
  sput_start_testing();
  sput_enter_suite("hncp_nio"); /* optional */
  argc -= 1;
  argv += 1;

  maybe_run_test(hncp_init_no_hwaddr);
  maybe_run_test(hncp_init_iofail);
  maybe_run_test(hncp_ok_minimal);
  maybe_run_test(hncp_rejoin_works);
  maybe_run_test(hncp_ok);
  sput_leave_suite(); /* optional */
  sput_finish_testing();
  return sput_get_return_value();
}
Example #12
0
static void dncp_io_basic_2()
{
  hncp_s h1, h2;
  dncp_s d1, d2;
  bool r;
  struct in6_addr a;
  char *msg = "foo";
  char *ifname = LOOPBACK_NAME;

  (void)uloop_init();
  memset(&h1, 0, sizeof(h1));
  memset(&h2, 0, sizeof(h2));
  memset(&d1, 0, sizeof(d1));
  memset(&d2, 0, sizeof(d2));
  h1.udp_port = 62000;
  h2.udp_port = 62001;
  h1.dncp = &d1;
  h2.dncp = &d2;
  d1.ext = &h1.ext;
  d2.ext = &h2.ext;
  r = hncp_io_init(&h1);
  sput_fail_unless(r, "dncp_io_init h1");
  r = hncp_io_init(&h2);
  sput_fail_unless(r, "dncp_io_init h2");

  /* Send a packet to ourselves */
  (void)inet_pton(AF_INET6, "::1", &a);
  struct sockaddr_in6 src = {
    .sin6_family = AF_INET6,
    .sin6_port = htons(h1.udp_port),
    .sin6_addr = a
#ifdef __APPLE__
    , .sin6_len = sizeof(struct sockaddr_in6)
#endif /* __APPLE__ */
  };
  struct sockaddr_in6 dst = {
    .sin6_family = AF_INET6,
    .sin6_port = htons(h2.udp_port),
    .sin6_addr = a
#ifdef __APPLE__
    , .sin6_len = sizeof(struct sockaddr_in6)
#endif /* __APPLE__ */
  };
  smock_push_int("dncp_poll_io_recvfrom", 3);
  smock_push_int("dncp_poll_io_recvfrom_src", &src);
  smock_push_int("dncp_poll_io_recvfrom_dst", &dst);
  smock_push_int("dncp_poll_io_recvfrom_buf", msg);
  smock_push_int("dncp_poll_io_recvfrom_ifname", ifname);
  h1.ext.cb.send(&h1.ext, dncp_find_ep_by_name(h1.dncp, "lo"),
                 NULL, &dst, msg, strlen(msg));
  pending_packets++;

  uloop_run();

  hncp_io_uninit(&h1);
  hncp_io_uninit(&h2);
}

int main(int argc, char **argv)
{
  setbuf(stdout, NULL); /* so that it's in sync with stderr when redirected */
  openlog("test_hncp_io", LOG_CONS | LOG_PERROR, LOG_DAEMON);
  sput_start_testing();
  sput_enter_suite("hncp_io"); /* optional */
  argc -= 1;
  argv += 1;

  sput_maybe_run_test(dncp_io_basic_2, do {} while(0));
  sput_leave_suite(); /* optional */
  sput_finish_testing();
  return sput_get_return_value();
}