浏览代码

+ simple CompareByte0 test

git-svn-id: trunk@9218 -
florian 17 年之前
父节点
当前提交
0801c64813
共有 2 个文件被更改,包括 24 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 23 0
      tests/test/tcmp0.pp

+ 1 - 0
.gitattributes

@@ -7040,6 +7040,7 @@ tests/test/tclass7.pp svneol=native#text/plain
 tests/test/tclass8.pp svneol=native#text/plain
 tests/test/tclrprop.pp svneol=native#text/plain
 tests/test/tcmp.pp svneol=native#text/plain
+tests/test/tcmp0.pp svneol=native#text/plain
 tests/test/tdispvar1.pp svneol=native#text/plain
 tests/test/tendian1.pp svneol=native#text/plain
 tests/test/tenum1.pp svneol=native#text/plain

+ 23 - 0
tests/test/tcmp0.pp

@@ -0,0 +1,23 @@
+program comparechar0bug;
+
+var str1 : pchar = 'test';
+    str2 : pchar = 'test';
+    str3 : pchar = 'testa';
+    str4 : pchar = 'asdf';
+    res : longint;
+begin
+  res:=CompareChar0(str1[0],str2[0],maxint);
+  if res<>0 then
+    halt(1);
+  res:=CompareChar0(str1[0],str3[0],maxint);
+  if res<>-1 then
+    halt(1);
+  res:=CompareChar0(str4[0],str1[0],maxint);
+  if res<>-1 then
+    halt(1);
+  res:=CompareChar0(str1[0],str4[0],maxint);
+  if res<>1 then
+    halt(1);
+
+  writeln('ok');
+end.