|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <boost/test/unit_test.hpp> |
|
|
|
#include "AlignmentInfo.h" |
|
#include "AlignmentInfoCollection.h" |
|
|
|
using namespace Moses; |
|
using namespace std; |
|
|
|
BOOST_AUTO_TEST_SUITE(alignment_info) |
|
|
|
typedef pair<size_t,size_t> IndexPair; |
|
typedef set<pair<size_t,size_t> > IndexSet; |
|
|
|
struct AlignmentInfoFixture { |
|
const AlignmentInfo* ai1; |
|
const AlignmentInfo* ai2; |
|
const AlignmentInfo* ai3; |
|
|
|
AlignmentInfoFixture() { |
|
AlignmentInfoCollection& collection = AlignmentInfoCollection::Instance(); |
|
IndexSet aligns1,aligns2,aligns3; |
|
aligns1.insert(IndexPair(1,1)); |
|
aligns1.insert(IndexPair(2,1)); |
|
aligns2.insert(IndexPair(1,1)); |
|
aligns2.insert(IndexPair(2,1)); |
|
aligns3.insert(IndexPair(1,2)); |
|
aligns3.insert(IndexPair(2,1)); |
|
ai1 = collection.Add(aligns1); |
|
ai2 = collection.Add(aligns2); |
|
ai3 = collection.Add(aligns3); |
|
} |
|
|
|
}; |
|
|
|
BOOST_FIXTURE_TEST_CASE(comparator, AlignmentInfoFixture) |
|
{ |
|
BOOST_CHECK(*ai1 == *ai2); |
|
BOOST_CHECK(*ai1 == *ai1); |
|
BOOST_CHECK(*ai2 == *ai2); |
|
BOOST_CHECK(*ai3 == *ai3); |
|
BOOST_CHECK(!(*ai2 == *ai3)); |
|
BOOST_CHECK(!(*ai1 == *ai3)); |
|
} |
|
|
|
BOOST_FIXTURE_TEST_CASE(hasher, AlignmentInfoFixture) |
|
{ |
|
|
|
AlignmentInfoHasher hash; |
|
BOOST_CHECK_EQUAL(hash(*ai1), hash(*ai2)); |
|
} |
|
|
|
BOOST_AUTO_TEST_SUITE_END() |
|
|