add text file read unit and test program to go with it
[lcore.git] / testreadtxt2.dpr
diff --git a/testreadtxt2.dpr b/testreadtxt2.dpr
new file mode 100644 (file)
index 0000000..a378293
--- /dev/null
@@ -0,0 +1,36 @@
+{ Copyright (C) 2009 Bas Steendijk and Peter Green\r
+  For conditions of distribution and use, see copyright notice in zlib_license.txt\r
+  which is included in the package\r
+  ----------------------------------------------------------------------------- }\r
+\r
+\r
+program testreadtxt2;\r
+uses readtxt2, classes;\r
+\r
+var\r
+  t: treadtxt;\r
+  f: file;\r
+procedure writestring(var f: file; s : string);\r
+begin\r
+  blockwrite(f,s[1],length(s));\r
+end;\r
+\r
+begin\r
+  assignfile(f,'mixed.txt');\r
+  rewrite(f,1);\r
+  writestring(f,'DOS'#13#10);\r
+  writestring(f,'UNIX'#10);\r
+  writestring(f,'MAC'#13);\r
+  writestring(f,'NONE');\r
+  closefile(f);\r
+  t := treadtxt.createf('mixed.txt');\r
+  if t.readline = 'DOS' then writeln('DOS success') else writeln('DOS fail');\r
+  if t.readline = 'UNIX' then writeln('UNIX success') else writeln('UNIX fail');\r
+  if t.readline = 'MAC' then writeln('MAC success') else writeln('MAC fail');\r
+  if t.readline = 'NONE' then writeln('NONE success') else writeln('NONE fail');\r
+  t.destroy;\r
+  {$ifdef win32}\r
+    //make things a little easier to test in the delphi GUI\r
+    readln;\r
+  {$endif}\r
+end.\r