Skip to content

Commit

Permalink
Add equality operator unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvasz committed Jan 1, 2012
1 parent 79abda9 commit 433a652
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/array_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,14 @@ class array_hash<std::string>
return false;
}

/**
* Inequality operator.
*/
bool operator!=(const array_hash<std::string>& rhs)
{
return !operator==(rhs);
}

class iterator : public std::iterator<std::bidirectional_iterator_tag,
const char *>
{
Expand Down
10 changes: 10 additions & 0 deletions test/array_hash_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,14 @@ CASE(testReverseIteration)
}
}

CASE(testEquality)
{
array_hash<string> a(data.begin(), data.end());
array_hash<string> b(data.begin(), data.end());
BOOST_CHECK(a == b);

array_hash<string> c;
BOOST_CHECK(a != c);
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 433a652

Please sign in to comment.