[uClibc-cvs] CVS uClibc++/tests

CVS User gkajmowi gkajmowi at codepoet.org
Sat Jan 8 17:49:56 UTC 2005


Update of /var/cvs/uClibc++/tests
In directory nail:/tmp/cvs-serv32356/tests

Modified Files:
	Makefile fstreamtest.cpp 
Log Message:
Fix fstream opening to use proper bitwise operators.
Fix fstream to check opening of file buffer and set failbit if need be.

--- /var/cvs/uClibc++/tests/Makefile	2004/12/23 16:06:46	1.11
+++ /var/cvs/uClibc++/tests/Makefile	2005/01/08 17:49:55	1.12
@@ -128,6 +128,7 @@
 
 clean:	cleanobjs cleanbin
 	$(MAKE) -C testoutput clean
+	rm -f fstreamtest.out
 
 cleanall:	cleanobjs cleanbin
 
--- /var/cvs/uClibc++/tests/fstreamtest.cpp	2004/12/18 22:00:53	1.2
+++ /var/cvs/uClibc++/tests/fstreamtest.cpp	2005/01/08 17:49:55	1.3
@@ -1,9 +1,31 @@
 #include <fstream>
+#include <iostream>
 
 int main()
 {
-	std::ofstream outFile("newout.txt", std::ios::out);
+	std::ofstream outFile("fstreamtest.out", std::ios::out);
 	outFile <<  "output data from fstreamtest" ;
+	for(unsigned char a = 0; a < 255 ; ++a){
+		outFile << a;
+	}
+	outFile.close();
+
+	std::ifstream inFile;
+	inFile.open("fstreamtest.out", std::ios::in | std::ios::binary );
+	char a;
+	unsigned char b;
+	for(int i = 0 ; i < 28; ++i){
+		inFile >> a;
+	}
+	for(unsigned char c = 0; c < 255; ++c){
+		inFile.get(a);
+		b = a;
+		if(c != b){
+			std::cout << "Error reading in character #" << (int)(c);
+			std::cout << ": read instead #" << (int)(b) << std::endl;
+		}
+	}
+	inFile.close();
 	return 0;
 }
 



More information about the uClibc-cvs mailing list