Skip to content

Commit

Permalink
Improve test coverage for logical operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadden committed Jul 6, 2018
1 parent 4632413 commit fde401f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/alia/signals/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@ struct logical_or_signal : signal<bool, read_only_signal>
|| arg1_.is_readable() && arg1_.read();
return value_;
}
bool
is_writable() const
{
return false;
}
void
write(bool const& value) const
{
}

private:
Arg0 arg0_;
Expand Down Expand Up @@ -150,15 +141,6 @@ struct logical_and_signal : signal<bool, read_only_signal>
|| arg1_.is_readable() && !arg1_.read());
return value_;
}
bool
is_writable() const
{
return false;
}
void
write(bool const& value) const
{
}

private:
Arg0 arg0_;
Expand Down
10 changes: 10 additions & 0 deletions unit_tests/signals/operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ TEST_CASE("signal &&", "[signals]")
});
REQUIRE(is_false(value(false) && access_counting_signal));
REQUIRE(access_count == 0);

// Check that value ID is reasonable.
REQUIRE(
(value(true) && value(false)).value_id()
!= (value(true) && value(true)).value_id());
}

TEST_CASE("signal ||", "[signals]")
Expand All @@ -90,6 +95,11 @@ TEST_CASE("signal ||", "[signals]")
});
REQUIRE(is_true(value(true) || access_counting_signal));
REQUIRE(access_count == 0);

// Check that value ID is reasonable.
REQUIRE(
(value(false) || value(false)).value_id()
!= (value(true) || value(false)).value_id());
}

TEST_CASE("select_signal", "[signals]")
Expand Down

0 comments on commit fde401f

Please sign in to comment.