Add eqp (pointer equality) tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
9e966a0e57
commit
f6e18045f3
2 changed files with 6 additions and 0 deletions
|
@ -168,6 +168,8 @@ unsigned length(sexpr const & s) {
|
|||
}
|
||||
|
||||
bool operator==(sexpr const & a, sexpr const & b) {
|
||||
if (eqp(a, b))
|
||||
return true;
|
||||
sexpr::kind ka = a.get_kind();
|
||||
sexpr::kind kb = b.get_kind();
|
||||
if (ka != kb)
|
||||
|
|
|
@ -69,6 +69,10 @@ static void tst1() {
|
|||
lean_assert(append(nil(), l) == l);
|
||||
lean_assert(contains(sexpr{10,20,-2,0,10}, [](sexpr e) { return to_int(e) < 0; }));
|
||||
lean_assert(!contains(sexpr{10,20,-2,0,10}, [](sexpr e) { return to_int(e) < -10; }));
|
||||
lean_assert(eqp(s1, s1));
|
||||
sexpr s3 = s1;
|
||||
lean_assert(eqp(s1, s3));
|
||||
lean_assert(!eqp(sexpr(1), sexpr(1)));
|
||||
}
|
||||
|
||||
static void tst2() {
|
||||
|
|
Loading…
Reference in a new issue