> you haven't explanined what the arguments to test do, but
> you appear to be mixing strcmp idioms.  i think you wish either
> 
>       test(strcmp(test_str, buf) == 0, 4, "check value\n");
> 
> or
>       test(!strcmp(test_str, buf), 4, "check value\n");

Right. Sorry...  The declaration for test is:

  void test(int bool, int space, ...);

where bool is the test case to prepend a pass/fail message in front of the
used defined message printed by vfprint.  Space is a pretty printing addon
that prints n spaces before the print message -- it makes it easier to
read.

The test you pointed out was a bad test.  Thanks for catching that!

The real problem was the test before it:

    ret = read(dtf, buf, strlen buf);
    test(strlen(tst_str)==ret,4, "read back from var\n");

Read actually correctly reads the file correctly (which the next test
verifies), but since I asked it to read 1K bytes when the message length is
only 39, read returns 0 instead of 39 and sets the file's offset to the end
of file as I would have expected.

I also should add if I did not before, this is on plan9port.


  EBo --


Reply via email to