lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Karman <pe...@peknet.com>
Subject Re: 64-bit linux errors with t/core/032-string_helper.t
Date Tue, 19 Jan 2010 20:14:17 GMT
Marvin Humphrey wrote on 01/19/2010 01:51 PM:
> On Tue, Jan 19, 2010 at 01:37:12PM -0600, Peter Karman wrote:
> 
>> ok - 0 == 0
>> ok - 1 == 1
>> ok - 100 == 100
>> ok - 126 == 126
>> ok - 127 == 127
>> ok - 128 == 128
>> ok - 129 == 129
>> ok - 250 == 250
>> ok - 254 == 254
>> ok - 255 == 255
> 
> Whew.  If that's the case, we ought to be able to make this work.
> 
> If you dump that same code into the TestStringHelper.c file, do you get the
> same result?  Checking for compiler flag weirdness or bizarre interactions
> from include libraries... (KinoSearch's tests once tickled a NetBSD bug that
> changed how doubles and long longs were converted to each other when a
> particular library was included...)
> 

I do get the same result.

Patch below (in case I messed it up):


Index: core/KinoSearch/Test/Util/TestStringHelper.c

===================================================================

--- core/KinoSearch/Test/Util/TestStringHelper.c        (revision 5710)

+++ core/KinoSearch/Test/Util/TestStringHelper.c        (working copy)

@@ -4,7 +4,20 @@

 #include "KinoSearch/Test/Util/TestStringHelper.h"

 #include "KinoSearch/Util/StringHelper.h"



+static unsigned char numbers[256];

+

 static void

+check_subscript(unsigned char subscript)

+{

+    if (subscript == numbers[subscript]) {

+        printf("ok - %d == %d\n", subscript, numbers[subscript]);

+    }

+    else {

+        printf("not ok - %d == %d\n", subscript, numbers[subscript]);

+    }

+}

+

+static void

 test_SKIP_and_TRAILING(TestBatch *batch)

 {

     u8_t i, max;

@@ -48,6 +61,37 @@

         ASSERT_TRUE(batch, StrHelp_UTF8_TRAILING[i] == 7,

             "UTF8_TRAILING bogus but no memory problems %d", (int)i);

     }

+    for (i=0, max=255; i < max; i++) {

+        printf("i == %d\n", i);

+        printf("UTF8_SKIP[%d] == %d\n", i, StrHelp_UTF8_SKIP[i]);

+    }

+    for (i=0, max=255; i < max; i++) {

+        printf("i == %d\n", i);

+        printf("UTF8_TRAILING[%d] == %d\n", i,
StrHelp_UTF8_TRAILING[i]);
+    }

+    for (i=0, max=255; i < max; i++) {

+        printf("i == %d\n", i);

+        printf("UTF8_SKIP[%d] == %d\n", i, StrHelp_UTF8_SKIP[i]);

+        printf("UTF8_TRAILING[%d] == %d\n", i,
StrHelp_UTF8_TRAILING[i]);
+        printf("i == %d\n", i);

+    }

+    printf("finally: i == %d\n", i);

+

+    int j;

+
+    for (j = 0; j < 256; j++) {
+        numbers[j] = j;
+    }
+    check_subscript(0);
+    check_subscript(1);
+    check_subscript(100);
+    check_subscript(126);
+    check_subscript(127);
+    check_subscript(128);
+    check_subscript(129);
+    check_subscript(250);
+    check_subscript(254);
+    check_subscript(255);
 }

-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Mime
View raw message