diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-11-07 05:10:22 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-11-07 05:10:22 +0000 |
commit | 9efe19dee959772b6fb0ff2db6e031458b418401 (patch) | |
tree | 6a246005af9582d55e475cd73c16d5b692f82edc /tests/Env_Value_Test.cpp | |
parent | 35825ef517ff8210b5be047aceba04c7107fb731 (diff) | |
download | ATCD-9efe19dee959772b6fb0ff2db6e031458b418401.tar.gz |
*** empty log message ***
Diffstat (limited to 'tests/Env_Value_Test.cpp')
-rw-r--r-- | tests/Env_Value_Test.cpp | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/tests/Env_Value_Test.cpp b/tests/Env_Value_Test.cpp index aaa347b3ffa..7f9fe0c30a5 100644 --- a/tests/Env_Value_Test.cpp +++ b/tests/Env_Value_Test.cpp @@ -26,16 +26,28 @@ USELIB("..\ace\aced.lib"); //--------------------------------------------------------------------------- #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ +#define TEST_THIS(type, varname, defval, expval) \ +do { \ + ACE_Env_Value<type> val (varname, (defval)); \ + if (val != (expval)) { \ + ACE_ERROR ((LM_ERROR, \ + "val %d does not match expected value of %d\n", \ + (int) (type) val, (int) (expval))); \ + } \ + ACE_ASSERT (val == (expval)); \ +} while (0) + int #if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) // ACE_HAS_NONSTATIC_OBJECT_MANAGER only allows main to have two -// arguments. And on VxWorks, which uses ACE_HAS_NONSTATIC_OBJECT_MANAGER, -// we can't use spawn because it doesn't have fork (). +// arguments. And on VxWorks, which uses +// ACE_HAS_NONSTATIC_OBJECT_MANAGER, we can't use spawn because it +// doesn't have <fork>. main (int argc, ASYS_TCHAR* []) { - ACE_UNUSED_ARG (argc); - ACE_OS::putenv("TEST_VALUE_POSITIVE=10.2"); - ACE_OS::putenv("TEST_VALUE_NEGATIVE=-10.2"); + ACE_UNUSED_ARG (argc); + ACE_OS::putenv ("TEST_VALUE_POSITIVE=10.2"); + ACE_OS::putenv ("TEST_VALUE_NEGATIVE=-10.2"); #else /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */ main (int argc, LPTSTR [], LPTSTR envp[]) { @@ -43,18 +55,20 @@ main (int argc, LPTSTR [], LPTSTR envp[]) { int status; - // No arguments means we're the initial test + // No arguments means we're the initial test. ACE_Process_Options options (1); status = options.setenv (envp); ACE_ASSERT (status == 0); options.command_line (ACE_TEXT ("Env_Value_Test run_as_test")); - status = options.setenv(ACE_TEXT ("TEST_VALUE_POSITIVE"), ACE_TEXT ("%s"), - ACE_TEXT ("10.2")); + status = options.setenv (ACE_TEXT ("TEST_VALUE_POSITIVE"), + ACE_TEXT ("%s"), + ACE_TEXT ("10.2")); ACE_ASSERT (status == 0); - status = options.setenv(ACE_TEXT ("TEST_VALUE_NEGATIVE"), ACE_TEXT ("%s"), - ACE_TEXT ("-10.2")); + status = options.setenv (ACE_TEXT ("TEST_VALUE_NEGATIVE"), + ACE_TEXT ("%s"), + ACE_TEXT ("-10.2")); ACE_ASSERT (status == 0); ACE_Process p; @@ -68,20 +82,6 @@ main (int argc, LPTSTR [], LPTSTR envp[]) // 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)); \ - if (val != (expval)) \ - { \ - ACE_ERROR ((LM_ERROR, \ - "val %d does not match expected value of %d\n", \ - (int) (type) val, (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); TEST_THIS (long, "TEST_VALUE_POSITIVE", 0, 10); @@ -96,16 +96,14 @@ main (int argc, LPTSTR [], LPTSTR envp[]) TEST_THIS (short, "TEST_VALUE_NEGATIVE", 0, -10); TEST_THIS (unsigned short, "TEST_VALUE_NEGATIVE", 0, (unsigned short) -10); - char* defstr = "Sarah Cleeland is Two!"; - ACE_Env_Value<char*> sval("This_Shouldnt_Be_Set_Hopefully", defstr); + char *defstr = "Sarah Cleeland is Two!"; + ACE_Env_Value<char *> sval ("This_Shouldnt_Be_Set_Hopefully", + defstr); ACE_ASSERT (ACE_OS::strcmp (sval, defstr) == 0); - ACE_END_TEST; } - return 0; } - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Env_Value<char*>; template class ACE_Env_Value<double>; @@ -122,4 +120,4 @@ main (int argc, LPTSTR [], LPTSTR envp[]) # pragma instantiate ACE_Env_Value<short> # pragma instantiate ACE_Env_Value<unsigned short> # pragma instantiate ACE_Env_Value<unsigned long> -#endif +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |