From 2204066a9488d2a368824a365d960effd2f06671 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 7 Apr 2017 20:06:19 +0200 Subject: [PATCH] Symbol: test coverage for empty and bool oh yeah yet another opportunity for mistakes --- src/lib/symbol.hpp | 3 +++ tests/15library.tests | 4 ++-- tests/library/symbol-test.cpp | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/lib/symbol.hpp b/src/lib/symbol.hpp index 8cb615345..f94ec2e5c 100644 --- a/src/lib/symbol.hpp +++ b/src/lib/symbol.hpp @@ -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; } }; diff --git a/tests/15library.tests b/tests/15library.tests index fc78c4517..5131419cc 100644 --- a/tests/15library.tests +++ b/tests/15library.tests @@ -540,8 +540,8 @@ END TEST "Symbol_test" Symbol_test <