summaryrefslogtreecommitdiff
path: root/ACE/tests/Bug_3532_Regression_Test.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2009-01-30 13:55:42 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2009-01-30 13:55:42 +0000
commit5a23c722b974a13915428953d2cd4c82577078ac (patch)
tree027c1c8ec168dbe16961fa62a08bb54152a0a2c1 /ACE/tests/Bug_3532_Regression_Test.cpp
parent6e030c43cc53b248d87c1c778c88b7a388f56fe4 (diff)
downloadATCD-5a23c722b974a13915428953d2cd4c82577078ac.tar.gz
Fri Jan 30 12:55:52 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/run_test.lst: * tests/tests.mpc: * tests/Bug_3532_Regression.cpp: Added a new test for bugzilla 3532. This bug is not fixed, just integrating the regression test. Thanks to Martin Gaus <Gaus@gmx.de> for creating this test
Diffstat (limited to 'ACE/tests/Bug_3532_Regression_Test.cpp')
-rw-r--r--ACE/tests/Bug_3532_Regression_Test.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/ACE/tests/Bug_3532_Regression_Test.cpp b/ACE/tests/Bug_3532_Regression_Test.cpp
new file mode 100644
index 00000000000..8d326e54c4c
--- /dev/null
+++ b/ACE/tests/Bug_3532_Regression_Test.cpp
@@ -0,0 +1,59 @@
+/**
+ * @file Bug_3532_Regression_Test.cpp
+ *
+ * $Id$
+ *
+ * Reproduces the problems reported in bug 3532
+ * http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=3532
+ *
+ * @author Martin Gaus <Gaus at gmx dot de>
+ */
+
+#include "test_config.h"
+#include "ace/ACE.h"
+
+ACE_RCSID (tests,
+ Bug_3532_Regression_Test,
+ "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT ("Bug_3532_Regression_Test"));
+
+ char Buffer[10];
+ int result = 0;
+
+ // Write a ASCII file with one byte (no BOM)
+ Buffer[0] = 'T';
+ FILE* pFile = ACE_OS::fopen("OneByteFile", "wb");
+ ACE_OS::fwrite(&Buffer, 1, 1, pFile);
+ ACE_OS::fclose(pFile);
+
+ // Reopen the file and read the byte
+ Buffer[0] = '-';
+ pFile = ACE_OS::fopen("OneByteFile", "rb");
+ size_t BytesRead = ACE_OS::fread(&Buffer, 1, 1, pFile);
+ if(BytesRead == 1)
+ {
+ if(Buffer[0] != 'T')
+ {
+ ++result;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Error: 'T' expected!!!\n")));
+ }
+ }
+ else
+ {
+ ++result;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Error: One byte should be read!!!\n")));
+ }
+
+ ACE_OS::fclose(pFile);
+
+ ACE_END_TEST;
+
+ return result;
+}
+