mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
Really simple sharding test
This commit is contained in:
parent
62d7d034bb
commit
fa6753b0f3
38
mert/DataTest.cpp
Normal file
38
mert/DataTest.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "Data.h"
|
||||
#include "Scorer.h"
|
||||
#include "ScorerFactory.h"
|
||||
|
||||
#define BOOST_TEST_MODULE MertData
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
|
||||
//very basic test of sharding
|
||||
BOOST_AUTO_TEST_CASE(shard_basic) {
|
||||
Scorer* scorer = ScorerFactory::getScorer("BLEU", "");
|
||||
Data data(*scorer);
|
||||
FeatureArray fa1, fa2, fa3, fa4;
|
||||
ScoreArray sa1, sa2, sa3, sa4;
|
||||
fa1.setIndex("1");
|
||||
fa2.setIndex("2");
|
||||
fa3.setIndex("3");
|
||||
fa4.setIndex("4");
|
||||
sa1.setIndex("1");
|
||||
sa2.setIndex("2");
|
||||
sa3.setIndex("3");
|
||||
sa4.setIndex("4");
|
||||
data.getFeatureData()->add(fa1);
|
||||
data.getFeatureData()->add(fa2);
|
||||
data.getFeatureData()->add(fa3);
|
||||
data.getFeatureData()->add(fa4);
|
||||
data.getScoreData()->add(sa1);
|
||||
data.getScoreData()->add(sa2);
|
||||
data.getScoreData()->add(sa3);
|
||||
data.getScoreData()->add(sa4);
|
||||
|
||||
vector<Data> shards;
|
||||
data.createShards(2,0,"",shards);
|
||||
|
||||
BOOST_CHECK_EQUAL(shards.size(),2);
|
||||
BOOST_CHECK_EQUAL(shards[1].getFeatureData()->size(),2);
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
import testing ;
|
||||
|
||||
lib m ;
|
||||
|
||||
lib mert_lib :
|
||||
@ -41,4 +43,6 @@ exe pro : pro.cpp mert_lib ..//boost_program_options ;
|
||||
|
||||
alias programs : mert extractor evaluator pro ;
|
||||
|
||||
unit-test data_test : DataTest.cpp mert_lib ..//boost_unit_test_framework ;
|
||||
|
||||
install legacy : programs : <location>. ;
|
||||
|
Loading…
Reference in New Issue
Block a user