Boolean Assertions

An assertion tool to verify boolean values.

  • GdUnitBoolAssert

    Function Description
    is_true Verifies that the current value is true.
    is_false Verifies that the current value is false.
    is_equal Verifies that the current value is equal to the given one.
    is_not_equal Verifies that the current value is not equal to the given one.
  • IBoolAssert

    Function Description
    IsTrue Verifies that the current value is true.
    IsFalse Verifies that the current value is false.
    IsEqual Verifies that the current value is equal to the given one.
    IsNotEqual Verifies that the current value is not equal to the given one.

Boolean Assert Examples

is_true

Verifies that the current value is true.

  •     func assert_bool(<current>).is_true() -> GdUnitBoolAssert
    
        # this assertion succeeds
        assert_bool(true).is_true()
    
        # this assertion fails because the value is false and not true
        assert_bool(false).is_true()
    
  •     public static IBoolAssert AssertThat(<current>).IsTrue()
    
        // this assertion succeeds
        AssertThat(true).IsTrue();
    
        // this assertion fails because the value is false and not true
        AssertThat(false).IsTrue();
    

is_false

Verifies that the current value is false.

  •     func assert_bool(<current>).is_false() -> GdUnitBoolAssert
    
        # this assertion succeeds
        assert_bool(false).is_false()
    
        # this assertion fails because the value is true and not false
        assert_bool(true).is_false()
    
  •     public static IBoolAssert AssertThat(<current>).IsFalse();
    
        // this assertion succeeds
        AssertThat(false).IsFalse();
    
        // this assertion fails because the value is true and not false
        AssertThat(true).IsFalse();
    

is_equal

Verifies that the current value is equal to the given one.

  •     func assert_bool(<current>).is_equal(<expected>) -> GdUnitBoolAssert
    
        # this assertion succeeds
        assert_bool(false).is_equal(false)
    
        # this assertion fails because the value is false and not true
        assert_bool(false).is_equal(true)
    
  •     public static IBoolAssert AssertThat(<current>).IsEqual(<expected>);
    
        // this assertion succeeds
        AssertThat(false).IsEqual(false);
    
        // this assertion fails because the value is false and not true
        AssertThat(false).IsEqual(true);
    

is_not_equal

Verifies that the current value is not equal to the given one.

  •     func assert_bool(<current>).is_not_equal(<expected>) -> GdUnitBoolAssert
    
        # this assertion succeeds
        assert_bool(false).is_not_equal(true)
    
        # this assertion fails because the value is false and should not be false
        assert_bool(false).is_not_equal(false)
    
  •     public static IBoolAssert AssertThat(<current>).IsNotEqual(<expected>);
    
        // this assertion succeeds
        AssertThat(false).IsNotEqual(true);
    
        // this assertion fails because the value is false and should not be false
        AssertThat(false).IsNotEqual(false);
    

Copyright © 2021-2024 Mike Schulze. Distributed by an MIT license.