diff --git a/tests/test_connect_delay.cpp b/tests/test_connect_delay.cpp
index 47d6595d..344dfabb 100644
--- a/tests/test_connect_delay.cpp
+++ b/tests/test_connect_delay.cpp
@@ -18,15 +18,15 @@ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see .
*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-
#include "../include/zmq.h"
+#include
+#include
+#include
+#include
+#include
+
+#undef NDEBUG
+#include
static void *server (void *)
{
diff --git a/tests/test_connect_resolve.cpp b/tests/test_connect_resolve.cpp
index b2b25b06..25367e34 100644
--- a/tests/test_connect_resolve.cpp
+++ b/tests/test_connect_resolve.cpp
@@ -18,12 +18,12 @@
along with this program. If not, see .
*/
-
-#include
+#include "../include/zmq.h"
#include
#include
-#include "../include/zmq.h"
+#undef NDEBUG
+#include
int main (void)
{
diff --git a/tests/test_hwm.cpp b/tests/test_hwm.cpp
index aa41e841..a3cba64a 100644
--- a/tests/test_hwm.cpp
+++ b/tests/test_hwm.cpp
@@ -19,9 +19,7 @@
*/
-#include
#include
-
#include "testutil.hpp"
int main (void)
diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp
index e74e705f..9a12c4d0 100644
--- a/tests/test_invalid_rep.cpp
+++ b/tests/test_invalid_rep.cpp
@@ -20,9 +20,11 @@
*/
#include "../include/zmq.h"
-#include
#include
+#undef NDEBUG
+#include
+
int main (void)
{
fprintf (stderr, "test_invalid_rep running...\n");
diff --git a/tests/test_last_endpoint.cpp b/tests/test_last_endpoint.cpp
index f476a63b..eb3a3f8f 100644
--- a/tests/test_last_endpoint.cpp
+++ b/tests/test_last_endpoint.cpp
@@ -19,10 +19,11 @@
along with this program. If not, see .
*/
-#include
+#include "../include/zmq.h"
#include
-#include "../include/zmq.h"
+#undef NDEBUG
+#include
static void do_bind_and_verify (void *s, const char *endpoint)
{
diff --git a/tests/test_monitor.cpp b/tests/test_monitor.cpp
index 084b0e04..fb335b69 100644
--- a/tests/test_monitor.cpp
+++ b/tests/test_monitor.cpp
@@ -19,12 +19,10 @@
along with this program. If not, see .
*/
-#include
-#include
-#include "testutil.hpp"
-
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
+#include
+#include "testutil.hpp"
static int events;
diff --git a/tests/test_msg_flags.cpp b/tests/test_msg_flags.cpp
index 34c10019..7ef685fe 100644
--- a/tests/test_msg_flags.cpp
+++ b/tests/test_msg_flags.cpp
@@ -19,10 +19,11 @@
along with this program. If not, see .
*/
-#include
+#include "../include/zmq.h"
#include
-#include "../include/zmq.h"
+#undef NDEBUG
+#include
int main (void)
{
diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp
index dbccf33c..7a18c993 100644
--- a/tests/test_pair_inproc.cpp
+++ b/tests/test_pair_inproc.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_pair_ipc.cpp b/tests/test_pair_ipc.cpp
index b9bad5df..ff9c6ec1 100644
--- a/tests/test_pair_ipc.cpp
+++ b/tests/test_pair_ipc.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp
index c0ce5c56..0efa3956 100644
--- a/tests/test_pair_tcp.cpp
+++ b/tests/test_pair_tcp.cpp
@@ -19,7 +19,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_reqrep_device.cpp b/tests/test_reqrep_device.cpp
index 1e05df4e..84f3cd08 100644
--- a/tests/test_reqrep_device.cpp
+++ b/tests/test_reqrep_device.cpp
@@ -19,11 +19,12 @@
along with this program. If not, see .
*/
-#include
-#include
-#include
-
#include "../include/zmq.h"
+#include
+#include
+
+#undef NDEBUG
+#include
int main (void)
{
diff --git a/tests/test_reqrep_inproc.cpp b/tests/test_reqrep_inproc.cpp
index 126e860a..a334d23e 100644
--- a/tests/test_reqrep_inproc.cpp
+++ b/tests/test_reqrep_inproc.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp
index 57dc442c..8753e8b3 100644
--- a/tests/test_reqrep_ipc.cpp
+++ b/tests/test_reqrep_ipc.cpp
@@ -18,7 +18,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp
index 3cdd0a2d..24305c15 100644
--- a/tests/test_reqrep_tcp.cpp
+++ b/tests/test_reqrep_tcp.cpp
@@ -19,7 +19,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_router_behavior.cpp b/tests/test_router_behavior.cpp
index 9fd90721..d0fec316 100644
--- a/tests/test_router_behavior.cpp
+++ b/tests/test_router_behavior.cpp
@@ -19,7 +19,6 @@
along with this program. If not, see .
*/
-#include
#include
#include "testutil.hpp"
diff --git a/tests/test_shutdown_stress.cpp b/tests/test_shutdown_stress.cpp
index 2d99afcd..8d8d7687 100644
--- a/tests/test_shutdown_stress.cpp
+++ b/tests/test_shutdown_stress.cpp
@@ -20,11 +20,13 @@
*/
#include "../include/zmq.h"
-#include
#include
#include
#include
+#undef NDEBUG
+#include
+
#define THREAD_COUNT 100
extern "C"
diff --git a/tests/test_sub_forward.cpp b/tests/test_sub_forward.cpp
index 9e4fd133..1aad8970 100644
--- a/tests/test_sub_forward.cpp
+++ b/tests/test_sub_forward.cpp
@@ -19,11 +19,12 @@
along with this program. If not, see .
*/
-#include
-#include
-
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
+#include
+
+#undef NDEBUG
+#include
int main (void)
{
diff --git a/tests/test_term_endpoint.cpp b/tests/test_term_endpoint.cpp
index 533446a0..5be71def 100644
--- a/tests/test_term_endpoint.cpp
+++ b/tests/test_term_endpoint.cpp
@@ -1,10 +1,31 @@
-#include
-#include
-#include
+/*
+ Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2011 iMatix Corporation
+ Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see .
+*/
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
+#include
+#include
+#undef NDEBUG
+#include
int main (void)
{
diff --git a/tests/test_timeo.cpp b/tests/test_timeo.cpp
index 4d58af72..b51e806a 100644
--- a/tests/test_timeo.cpp
+++ b/tests/test_timeo.cpp
@@ -18,13 +18,14 @@
along with this program. If not, see .
*/
-#include
-#include
-#include
-#include
-
#include "../include/zmq.h"
#include "../include/zmq_utils.h"
+#include
+#include
+#include
+
+#undef NDEBUG
+#include
extern "C"
{
diff --git a/tests/testutil.hpp b/tests/testutil.hpp
index e68dc328..e738a71c 100644
--- a/tests/testutil.hpp
+++ b/tests/testutil.hpp
@@ -22,10 +22,11 @@
#ifndef __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
#define __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
-#include
+#include "../include/zmq.h"
#include
-#include "../include/zmq.h"
+#undef NDEBUG
+#include
inline void bounce (void *sb, void *sc)
{