summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-04 18:36:47 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-04 18:36:47 +0000
commitda674888c9b0a2f9ea9b1e6fa75b1009cad553f5 (patch)
tree794d7c1ae15137a06da8a0fee2b5ad794338051d /tests
parentc2a33b0fa341c778ac1a768149c04e2d91d4aad4 (diff)
downloadATCD-da674888c9b0a2f9ea9b1e6fa75b1009cad553f5.tar.gz
hacked to work with ACE_HAS_NONSTATIC_OBJECT_MANAGER.
Diffstat (limited to 'tests')
-rw-r--r--tests/Env_Value_Test.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/tests/Env_Value_Test.cpp b/tests/Env_Value_Test.cpp
index 1e8867a34ba..23f3a70e264 100644
--- a/tests/Env_Value_Test.cpp
+++ b/tests/Env_Value_Test.cpp
@@ -14,20 +14,22 @@
//
// ============================================================================
-// main () has three arguments, so we can't use
-// ACE_HAS_NONSTATIC_OBJECT_MANAGER. We don't need it, anyways.
-#include "ace/inc_user_config.h"
-#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
-# undef ACE_HAS_NONSTATIC_OBJECT_MANAGER
-#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */
-
#include "test_config.h"
#include "ace/OS.h"
#include "ace/Process.h"
#include "ace/Env_Value_T.h"
int
-main (int argc, char *[], char* envp[])
+#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
+// ACE_HAS_NONSTATIC_OBJECT_MANAGER only allows main to have two
+// arguments. And with it, we can't use spawn.
+main (int argc, char *[])
+{
+ ACE_UNUSED_ARG (argc);
+ ::putenv("TEST_VALUE_POSITIVE=10.2");
+ ::putenv("TEST_VALUE_NEGATIVE=-10.2");
+#else /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */
+ main (int argc, char *[], char* envp[])
{
if (argc == 1)
{
@@ -41,15 +43,29 @@ main (int argc, char *[], char* envp[])
options.setenv("TEST_VALUE_NEGATIVE", "%s", "-10.2");
ACE_Process p;
- ACE_ASSERT (p.spawn (options) != -1);
+ pid_t result = p.spawn (options);
+ ACE_ASSERT (result != -1);
p.wait ();
}
else
+#endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */
{
// In this case we're the child
ACE_START_TEST ("Env_Value_Test");
-#define TEST_THIS(type,varname,defval,expval) do { ACE_Env_Value<type> val(varname, (defval)); ACE_ASSERT (val == (expval)); } while (0)
+#define TEST_THIS(type,varname,defval,expval) \
+ do \
+ { \
+ ACE_Env_Value<type> val (varname, (defval)); \
+ if (val != (expval)) \
+ { \
+ ACE_ERROR ((LM_ERROR, \
+ "val %u does not expected value of %u\n", \
+ (u_int) val, (u_int) (expval))); \
+ } \
+ ACE_ASSERT (val == (expval)); \
+ } \
+ while (0)
TEST_THIS (int, "TEST_VALUE_POSITIVE", 4, 10);
TEST_THIS (double, "TEST_VALUE_POSITIVE", -1.0, 10.2);