#240 self-test SORT failing

closed-fixed
elsapo
None
5
2006-06-08
2006-06-08
elsapo
No

sort & rsort failing in self-test suite

I think it is a problem with the or operator.

This test:

push(li, "aardvark")
push(li, "coon")
push(li, "bear")
push(li, "eel")
push(li, "dog")
sort(li)
print(getel(li, 1), "\n")
print(getel(li, 2), "\n")
print(getel(li, 3), "\n")
print(getel(li, 4), "\n")
print(getel(li, 5), "\n")
set(ax, getel(li, 1))
set(ay, "aardvark")
print("ax=", ax, "\n")
print("ay=", ay, "\n")
if (ne(ax, ay)) { print("ax != ay\n") } else {
print("ax == ay\n") }
if (or(ne(ax, ay), 0)) { print("or...ax != ay\n") }
else { print("or... ax == ay\n") }

gives:

aardvark
bear
coon
dog
eel
ax=aardvark
ay=aardvark
ax == ay
or...ax != ay

This suggests to me that the or test is not evaluating
correctly.

Discussion

  • elsapo

    elsapo - 2006-06-08

    Logged In: YES
    user_id=1195173

    llrpt_or is buggy -- it initialized rc to TRUE, and then
    does logical or against each argument, so of course it winds
    up TRUE at the end. Probably a copy&paste error from the
    llrpt_and function.

     
  • elsapo

    elsapo - 2006-06-08
    • assigned_to: nobody --> elsapo
    • status: open --> closed-fixed
     
  • elsapo

    elsapo - 2006-06-08

    Logged In: YES
    user_id=1195173

    Fix in cvs:

    **

    Fix report or operator by fixing llrpt_or to initialize
    variable rc to FALSE.

    **

    Checking in ChangeLog;
    /cvsroot/lifelines/lifelines/ChangeLog,v <-- ChangeLog
    new revision: 1.1842; previous revision: 1.1841
    done
    Checking in src/interp/builtin.c;
    /cvsroot/lifelines/lifelines/src/interp/builtin.c,v <--
    builtin.c
    new revision: 1.189; previous revision: 1.188
    done

    Success, CVS operation completed

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks