Skip to content

Commit

Permalink
Revert "ws tests improved"
Browse files Browse the repository at this point in the history
This reverts commit fdabf7f.
  • Loading branch information
sustrik committed Nov 27, 2014
1 parent 1017b0f commit d924a77
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 155 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ tests/zerocopy
tests/term
tests/cmsg
tests/ws
tests/ws_shutdown
tests/tcpmux
*.dir
*.vcxproj
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ add_libnanomsg_test (ipc_stress)
add_libnanomsg_test (tcp)
add_libnanomsg_test (tcp_shutdown)
add_libnanomsg_test (ws)
add_libnanomsg_test (ws_shutdown)
add_libnanomsg_test (tcpmux)

# Protocol tests.
Expand Down
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ TRANSPORT_TESTS = \
tests/tcp \
tests/tcp_shutdown \
tests/ws \
tests/ws_shutdown \
tests/tcpmux

PROTOCOL_TESTS = \
Expand Down
53 changes: 20 additions & 33 deletions tests/ws.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2012 250bpm s.r.o. All rights reserved.
Copyright (c) 2014 Wirebird Labs LLC. All rights reserved.
Copyright (c) 2014 250bpm s.r.o. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -36,7 +36,8 @@ int main ()
int rc;
int sb;
int sc;
int i;
//int opt;
//size_t sz;

/* Try closing bound but unconnected socket. */
sb = test_socket (AF_SP, NN_PAIR);
Expand All @@ -52,6 +53,23 @@ int main ()
/* Open the socket anew. */
sc = test_socket (AF_SP, NN_PAIR);

/* Check socket options. */
//sz = sizeof (opt);
//rc = nn_getsockopt (sc, NN_WS, NN_WS_HANDSHAKE_TIMEOUT, &opt, &sz);
//errno_assert (rc == 0);
//nn_assert (sz == sizeof (opt));
//nn_assert (opt == 1000);
//opt = 100;
//sz = sizeof (opt);
//rc = nn_getsockopt (sc, NN_WS, NN_WS_HANDSHAKE_TIMEOUT, &opt, &sz);
//errno_assert (rc == 0);
//nn_assert (sz == sizeof (opt));
//nn_assert (opt == 100);

/* Default port 80 should be assumed if not explicitly declared. */
rc = nn_connect (sc, "ws://127.0.0.1");
errno_assert (rc >= 0);

/* Try using invalid address strings. */
rc = nn_connect (sc, "ws://*:");
nn_assert (rc < 0);
Expand Down Expand Up @@ -99,36 +117,5 @@ int main ()

test_close (sc);

sb = test_socket (AF_SP, NN_PAIR);
test_bind (sb, "ws://127.0.0.1:5555");
sc = test_socket (AF_SP, NN_PAIR);
test_connect (sc, "ws://127.0.0.1:5555");

/* Ping-pong test. */
for (i = 0; i != 100; ++i) {
test_send (sc, "ABC");
test_recv (sb, "ABC");
test_send (sb, "DEF");
test_recv (sc, "DEF");
}

/* Batch transfer test. */
for (i = 0; i != 100; ++i) {
test_send (sc, "01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789");
}
for (i = 0; i != 100; ++i) {
test_recv (sb, "01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789");
}

test_close (sc);
test_close (sb);

return 0;
}

119 changes: 0 additions & 119 deletions tests/ws_shutdown.c

This file was deleted.

0 comments on commit d924a77

Please sign in to comment.