コード例 #1
0
ファイル: netdb.c プロジェクト: repos-holder/openbsd-patches
int
main(int argc, char **argv)
{
	test_serv();
	test_localhost();
	test_host();

	SUCCEED;
}
コード例 #2
0
ファイル: mrtest.c プロジェクト: sipb/athena-svn-mirror
void execute_line(char *cmdbuf)
{
  int argc;
  char *argv[MAXARGS];

  argc = parse(cmdbuf, argv);
  if (argc == 0)
    return;
  if (!strcmp(argv[0], "noop"))
    test_noop();
  else if (!strcmp(argv[0], "connect") || !strcmp(argv[0], "c"))
    test_connect(argc, argv);
  else if (!strcmp(argv[0], "disconnect") || !strcmp(argv[0], "d"))
    test_disconnect();
  else if (!strcmp(argv[0], "host"))
    test_host();
  else if (!strcmp(argv[0], "motd") || !strcmp(argv[0], "m"))
    test_motd();
  else if (!strcmp(argv[0], "query") || !strcmp(argv[0], "qy"))
    test_query(argc, argv);
  else if (!strcmp(argv[0], "auth") || !strcmp(argv[0], "a"))
    test_krb5_auth();
  else if (!strcmp(argv[0], "proxy") || !strcmp(argv[0], "p"))
    test_proxy(argc, argv);
  else if (!strcmp(argv[0], "access"))
    test_access(argc, argv);
  else if (!strcmp(argv[0], "dcm"))
    test_dcm();
  else if (!strcmp(argv[0], "script") || !strcmp(argv[0], "s"))
    test_script(argc, argv);
  else if (!strcmp(argv[0], "list_requests") ||
	  !strcmp(argv[0], "lr") || !strcmp(argv[0], "?"))
    test_list_requests();
  else if (!strcmp(argv[0], "quit") || !strcmp(argv[0], "Q"))
    quit = 1;
  else if (!strcmp(argv[0], "version") || !strcmp(argv[0], "v"))
    test_version(argc, argv);
  else if (!strcmp(argv[0], "krb4_auth") || !strcmp(argv[0], "4"))
    test_auth();
  else
    {
      fprintf(stderr, "moira: Unknown request \"%s\".  "
	      "Type \"?\" for a request list.\n", argv[0]);
    }
}
コード例 #3
0
int main(int argc, char *argv[]) {
	const char *usage = "Usage: [-f conf file] [-t hostname/ip[:port]]"; 
	char *filename = NULL;
	char *testhost = NULL;
   struct parsedfile config;
	int i;

	if ((argc > 5) || (((argc - 1) % 2) != 0)) {
		show_msg(MSGERR, "Invalid number of arguments\n");
		show_msg(MSGERR, "%s\n", usage);
		exit(1);
	}

	for (i = 1; i < argc; i = i + 2) {
		if (!strcmp(argv[i], "-f")) {
			filename = argv[(i + 1)];
		} else if (!strcmp(argv[i], "-t")) {
			testhost = argv[(i + 1)];
		} else {
			show_msg(MSGERR, "Unknown option %s\n", argv[i]);
			show_msg(MSGERR, "%s\n", usage);
			exit(1);
		}
	}

	if (!filename) 
		filename = strdup(CONF_FILE);

	printf("Reading configuration file %s...\n", filename);
	if (read_config(filename, &config) == 0)
		printf("... Read complete\n\n");
	else 
		exit(1);

	/* If they specified a test host, test it, otherwise */
	/* dump the configuration                            */
	if (!testhost)
		show_conf(&config);
	else
		test_host(&config, testhost);
	
	return(0);  
}
コード例 #4
0
void WiFlyUDPTest::testWriteRead() {
    // Arrange
    IPAddress test_host(255, 255, 255, 255);
    size_t test_packet_len = 4;
    char test_packet[5] = "HOLA";
    char response[5] = {0};

    // Act
    WiFlyWiFi.begin((char *)SECURED_SSID, (char *)SECURED_PASS);
    WiFlyUDP.beginPacket(test_host, 2000);
    WiFlyUDP.write((const uint8_t *)test_packet, test_packet_len);
    WiFlyUDP.endPacket();
    int result_read = WiFlyUDP.read(response, test_packet_len, 5000);

    // Assert
    assertEqual(result_read, test_packet_len);
    char *match = strstr(response, test_packet);
    assertTrue(response == match);
}