Back to index

nagios-plugins  1.4.16
Functions
test_tcp.c File Reference
#include "common.h"
#include "utils_tcp.h"
#include "tap.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file test_tcp.c.

{
       char** server_expect;
       int server_expect_count = 3;
       plan_tests(8);

       server_expect = malloc(sizeof(char*) * server_expect_count);

       server_expect[0] = strdup("AA");
       server_expect[1] = strdup("bb");
       server_expect[2] = strdup("CC");
       
       ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, FALSE, TRUE, FALSE) == TRUE,
          "Test matching any string at the beginning (first expect string)");
       ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, FALSE, TRUE, FALSE) == TRUE,
          "Test matching any string at the beginning (second expect string)");
       ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, FALSE, TRUE, FALSE) == FALSE,
          "Test with strings not matching at the beginning");
       ok(np_expect_match("XX CC XX", server_expect, server_expect_count, FALSE, TRUE, FALSE) == FALSE,
          "Test matching any string");
       ok(np_expect_match("XX", server_expect, server_expect_count, FALSE, FALSE, FALSE) == FALSE,
          "Test not matching any string");
       ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, TRUE, FALSE, FALSE) == TRUE,
          "Test matching all strings");
       ok(np_expect_match("XX bb CC XX", server_expect, server_expect_count, TRUE, FALSE, FALSE) == FALSE,
          "Test not matching all strings");
       ok(np_expect_match("XX XX", server_expect, server_expect_count, TRUE, FALSE, FALSE) == FALSE,
          "Test not matching any string (testing all)");
        

       return exit_status();
}

Here is the call graph for this function: