Symbol: test coverage for empty and bool
oh yeah yet another opportunity for mistakes
This commit is contained in:
parent
4df59678a3
commit
2204066a94
3 changed files with 17 additions and 4 deletions
|
|
@ -123,6 +123,9 @@ namespace lib {
|
|||
|
||||
Symbol& operator= (Symbol const&) = default;
|
||||
Symbol& operator= (Symbol &&) = default;
|
||||
|
||||
explicit operator bool() const { return not empty(); }
|
||||
bool empty() const { return *this == BOTTOM; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -540,8 +540,8 @@ END
|
|||
TEST "Symbol_test" Symbol_test <<END
|
||||
out: one
|
||||
out: sizeof. Literal.+ = (4|8)
|
||||
out-lit: string
|
||||
out-lit: string
|
||||
out-lit: onenight
|
||||
out-lit: minus one
|
||||
out-lit: one....one
|
||||
return: 0
|
||||
END
|
||||
|
|
|
|||
|
|
@ -80,8 +80,10 @@ namespace test{
|
|||
CHECK (li2 != li3);
|
||||
CHECK (li3 != li2);
|
||||
|
||||
cout << typeStr (li1 + string("ce")) << endl;
|
||||
cout << typeStr (string("minus " +li1)) << endl;
|
||||
CHECK ("string" == typeStr (li1 + string{"night"}));
|
||||
CHECK ("string" == typeStr (string{"minus " +li1}));
|
||||
cout << li1 + string{"night"} << endl;
|
||||
cout << string{"minus " +li1} << endl;
|
||||
cout << li2+string("..") << string("..")+li2 << endl;
|
||||
|
||||
CHECK (hash_value(li1) == hash_value(li2));
|
||||
|
|
@ -117,9 +119,17 @@ namespace test{
|
|||
CHECK (sy1.c() == sy2.c());
|
||||
|
||||
Symbol sy3;
|
||||
CHECK (not sy3);
|
||||
CHECK (sy3 == "⟂");
|
||||
CHECK (isnil(sy3));
|
||||
CHECK (sy1 != sy3);
|
||||
|
||||
CHECK (not Symbol{"⟂"});
|
||||
CHECK (sy3 == Symbol{"⟂"});
|
||||
CHECK (sy3.c() == Symbol{"⟂"}.c());
|
||||
CHECK (Symbol{}.c() == Symbol{"⟂"}.c());
|
||||
|
||||
// re-assignment
|
||||
sy3 = Symbol{l1};
|
||||
CHECK (!isnil(sy3));
|
||||
CHECK (sy1 == sy3);
|
||||
|
|
|
|||
Loading…
Reference in a new issue