diff options
Diffstat (limited to 'testing/fulltests/unit-tests/T009large_fd_set_clib.c')
-rw-r--r-- | testing/fulltests/unit-tests/T009large_fd_set_clib.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/fulltests/unit-tests/T009large_fd_set_clib.c b/testing/fulltests/unit-tests/T009large_fd_set_clib.c new file mode 100644 index 0000000..eee4d41 --- /dev/null +++ b/testing/fulltests/unit-tests/T009large_fd_set_clib.c @@ -0,0 +1,46 @@ +/* HEADER Testing netsnmp_large_fd_set */ + +netsnmp_large_fd_set fds; +netsnmp_large_fd_set_init(&fds, 2000); +OKF(fds.lfs_setsize == 2000, ("initialization")); +OKF(netsnmp_large_fd_set_resize(&fds, 2000) == 1, ("resizing to 2000")); +NETSNMP_LARGE_FD_ZERO(&fds); + +{ + int i; + for (i = 0; i < fds.lfs_setsize; ++i) { + OKF(!NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is not set", i)); + NETSNMP_LARGE_FD_SET(i, &fds); + OKF(NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is set", i)); + NETSNMP_LARGE_FD_CLR(i, &fds); + OKF(!NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is not set", i)); + } +} + +OKF(netsnmp_large_fd_set_resize(&fds, 3000) == 1, ("resizing to 3000")); + +{ + int i; + for (i = 0; i < fds.lfs_setsize; ++i) { + OKF(!NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is not set", i)); + NETSNMP_LARGE_FD_SET(i, &fds); + OKF(NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is set", i)); + NETSNMP_LARGE_FD_CLR(i, &fds); + OKF(!NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is not set", i)); + } +} + +OKF(netsnmp_large_fd_set_resize(&fds, 1000) == 1, ("resizing to 1000")); + +{ + int i; + for (i = 0; i < fds.lfs_setsize; ++i) { + OKF(!NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is not set", i)); + NETSNMP_LARGE_FD_SET(i, &fds); + OKF(NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is set", i)); + NETSNMP_LARGE_FD_CLR(i, &fds); + OKF(!NETSNMP_LARGE_FD_ISSET(i, &fds), ("%d is not set", i)); + } +} + +netsnmp_large_fd_set_cleanup(&fds); |