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();
}
Exemple #2
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 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();
}
Exemple #4
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();
}
Exemple #5
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();
}
int TestCRC32()
{
    sput_start_testing();
    sput_enter_suite("Test crc32...");

    sput_run_test(Test_CRC);

    sput_finish_testing();
    return sput_get_return_value();
}
Exemple #7
0
int main(){
  sput_start_testing();
  themispp::secure_cell_test::run_secure_cell_test();
  themispp::secure_message_test::run_secure_message_test();
  themispp::secure_session_test::run_secure_session_test();
#ifdef SECURE_COMPARATOR_ENABLED
  themispp::secure_session_test::run_secure_comparator_test();
#endif
  sput_finish_testing();
  return sput_get_return_value();
}
Exemple #8
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 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();
}
Exemple #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();

}
Exemple #11
0
int main() {
	sput_start_testing();
	sput_enter_suite("Prince Test 1");
	sput_run_test(prince_test_1);
	sput_enter_suite("Prince Test 2");
	sput_run_test(prince_test_2);
	sput_enter_suite("Prince Test 3");
	sput_run_test(prince_test_3);
	sput_enter_suite("Prince Test 4");
	sput_run_test(prince_test_4);
	sput_finish_testing();
	return sput_get_return_value();
}
Exemple #12
0
int main()
{
    sput_start_testing();

    sput_enter_suite("mjson: Parsing tests");
    sput_run_test(mjson_valid_syntax_tests);
    sput_run_test(mjson_invalid_syntax_tests);

    sput_enter_suite("mjson: Data tests");
    sput_run_test(mjson_content_tests);

    sput_finish_testing();

    return sput_get_return_value();
}
Exemple #13
0
int main(void)
{
    sput_start_testing();

    sput_enter_suite("Lab 7, Exercise 1: intlist_construct()");
    sput_run_test(test_intlist_construct);

    test_intlist_print();

    sput_enter_suite("Lab 7, Exercise 3: intlist_append()");
    sput_run_test(test_intlist_append);

    sput_enter_suite("Lab 7, Exercise 4: intlist_capacity()");
    sput_run_test(test_intlist_capacity);

    sput_enter_suite("Lab 7, Exercise 5: intlist_size()");
    sput_run_test(test_intlist_size);

    sput_enter_suite("Lab 7, Exercise 6: intlist_get()");
    sput_run_test(test_intlist_get);

    sput_enter_suite("Lab 7, Exercise 7: intlist_set()");
    sput_run_test(test_intlist_set);

    sput_enter_suite("Lab 7, Exercise 8: intlist_removeall()");
    sput_run_test(test_intlist_removeall);

    sput_enter_suite("Lab 8, Exercise 1: intlist_index()");
    sput_run_test(test_intlist_index);

    sput_enter_suite("Lab 8, Exercise 2: intlist_count()");
    sput_run_test(test_intlist_count);

    sput_enter_suite("Lab 8, Exercise 3: intlist_contains()");
    sput_run_test(test_intlist_contains);

    sput_enter_suite("Lab 8, Exercise 4: increase_capacity()");
    sput_run_test(test_increase_capacity);

    sput_enter_suite("Lab 8, Exercise 5: modified intlist_append()");
    sput_run_test(test_modified_intlist_append);

    sput_enter_suite("Lab 8, Exercise 6: intlist_delete()");
    sput_run_test(test_intlist_delete);

    sput_finish_testing();
    return sput_get_return_value();
}
Exemple #14
0
int main(void)
{
    sput_start_testing();

    sput_enter_suite("daIsEmpty should fail if any paramter is NULL");
    sput_run_test(testNull);

    sput_enter_suite("daIsEmpty should return the fill state of the array");
    sput_run_test(testValid);

    sput_enter_suite("daIsEmpty should fail if the magic number in the header mismatches the expected magic number");
    sput_run_test(testMagic);

    sput_finish_testing();

    return sput_get_return_value();
}
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();
}
Exemple #16
0
int run_bit_tests()
{
    sput_start_testing();

    sput_enter_suite("CORE bits: test bit_ffs32");
    sput_run_test(test_ffs32);
    sput_enter_suite("CORE bits: test bit_fls32");
    sput_run_test(test_fls32);
    sput_enter_suite("CORE bits: test bit_ffs64");
    sput_run_test(test_ffs64);
    sput_enter_suite("CORE bits: test bit_fls64");
    sput_run_test(test_fls64);

    sput_finish_testing();

    return sput_get_return_value();
}
Exemple #17
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();
}
Exemple #18
0
int main(int argc, char const *argv[])
{
	//run unit tests
	#ifdef UNITTST

	sput_start_testing();
	sput_enter_suite("getrecurtm(): RECUR parsing");
	sput_run_test(test_getrecur);

	sput_enter_suite("gettm() parsing");
	sput_run_test(test_gettm_success);
	sput_run_test(test_gettm_fail);

	sput_finish_testing();
	#endif

	test_getformat_success();

 	return EXIT_SUCCESS;
}
Exemple #19
0
int main(void)
{
    sput_start_testing();

    sput_enter_suite("daClear should fail if any paramter is NULL");
    sput_run_test(testNull);

    sput_enter_suite("daClear should succeed if everything is okay");
    sput_run_test(testValid);

    sput_enter_suite("daClear should fail if we pass an unknown mode");
    sput_run_test(testUnknownMode);

    sput_enter_suite("daClear should fail if the magic number in the header mismatches the expected magic number");
    sput_run_test(testMagic);

    sput_finish_testing();

    return sput_get_return_value();
}
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();
}
Exemple #21
0
int main(void)
{
    sput_start_testing();

    sput_enter_suite("Exercise 1: max()");
    sput_run_test(test_max);

    sput_enter_suite("Exercise 2: min()");
    sput_run_test(test_min);

    sput_enter_suite("Exercise 3: normalize()");
    sput_run_test(test_normalize);

    sput_enter_suite("Exercise 4: avg_magnitude()");
    sput_run_test(test_avg_magnitude);

    sput_enter_suite("Exercise 5: avg_power()");
    sput_run_test(test_avg_power);

    sput_finish_testing();
    return sput_get_return_value();
}
Exemple #22
0
int main(int argc, char** argv){
	sput_start_testing();

	sput_enter_suite("cursor");
	sput_run_test(test_cursor);

	sput_enter_suite("btree");
	sput_run_test(test_btree);
    sput_run_test(test_btree_cursor);

	sput_enter_suite("filestore");
	sput_run_test(test_filestore);

	sput_enter_suite("array");
	sput_run_test(test_array);
	sput_run_test(test_big_array);

    sput_enter_suite("mtree");
    sput_run_test(test_mtree);
	
	sput_finish_testing();
	return sput_get_return_value();
}
Exemple #23
0
int main(int argc, const char * argv[])
{
    sput_start_testing();
    
    sput_enter_suite("snFrameHeader tests");
    sput_run_test(testFrameHeaderSerialization);
    sput_run_test(testFrameHeaderValidation);
    sput_run_test(testMasking);
    
    sput_enter_suite("snFrameParser tests");
    sput_run_test(testFrameParserHeaderEquality);
    
    sput_enter_suite("snOpeningHandshakeParser tests");
    sput_run_test(testWellFormedResponse);
    sput_run_test(testWrongHTTPStatus);
    sput_run_test(testMissingWebsocketKey);
    sput_run_test(testHeaderFollowedByFrames);
    
    sput_enter_suite("snWebsocket state tests");
    sput_run_test(testConnectionState);
    
    sput_finish_testing();
}
Exemple #24
0
int main(void)
{
    sput_start_testing();

    test_print_fraction();

    sput_enter_suite("Exercise 2: gcd()");
    sput_run_test(test_gcd);

    sput_enter_suite("Exercise 3: reduce()");
    sput_run_test(test_reduce);

    sput_enter_suite("Exercise 4: make_fraction()");
    sput_run_test(test_make_fraction);

    sput_enter_suite("Exercise 5: add_fractions()");
    sput_run_test(test_add_fractions);

    sput_enter_suite("Exercise 6: multiply_fractions()");
    sput_run_test(test_multiply_fractions); 

    sput_finish_testing();
    return sput_get_return_value();
}
Exemple #25
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();
}