Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assert F function #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/kunit.kl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ ROUTINE kunit_done
--
-- kunit_assert(false)
-- # => false
ROUTINE kunit_assert(actual : BOOLEAN) : BOOLEAN
ROUTINE kunit_assert_t(actual : BOOLEAN) : BOOLEAN
BEGIN
assrtn_count = assrtn_count + 1

Expand All @@ -150,7 +150,30 @@ ROUTINE kunit_assert(actual : BOOLEAN) : BOOLEAN
error_msg = 'Expected true but got false'
RETURN(false)
ENDIF
END kunit_assert
END kunit_assert_t

-- Public: Assert that something is false
--
-- actual - A BOOLEAN value
--
-- Examples
--
-- kunit_assert_f(true)
-- # => false
--
-- kunit_assert_f(false)
-- # => true
ROUTINE kunit_assert_f(actual : BOOLEAN) : BOOLEAN
BEGIN
assrtn_count = assrtn_count + 1

IF NOT actual THEN
RETURN(true)
ELSE
error_msg = 'Expected false but got true'
RETURN(false)
ENDIF
END kunit_assert_f

-- Public: Assert that two INTEGERs are equal
--
Expand Down