diff options
Diffstat (limited to 'phrase-extract')
-rw-r--r-- | phrase-extract/ScoreFeatureTest.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/phrase-extract/ScoreFeatureTest.cpp b/phrase-extract/ScoreFeatureTest.cpp index cc22f8630..0ed2f71e6 100644 --- a/phrase-extract/ScoreFeatureTest.cpp +++ b/phrase-extract/ScoreFeatureTest.cpp @@ -26,6 +26,7 @@ #include <boost/test/unit_test.hpp> #include <unordered_set> +#include <unordered_map> using namespace MosesTraining; using namespace std; @@ -81,6 +82,16 @@ static void checkDomainConfigured( BOOST_CHECK(manager.includeSentenceId()); } +template<typename T> +T adder(T v) { + return v; +} + +template<typename T, typename... Args> +T adder(T first, Args... args) { + return first + adder(args...); +} + BOOST_AUTO_TEST_CASE(manager_config_domain) { checkDomainConfigured<RatioDomainFeature> @@ -102,8 +113,23 @@ BOOST_AUTO_TEST_CASE(manager_config_domain) s.insert(4); s.insert(1); -for (auto i: s) { + for (auto i: s) { cerr << i << " "; } + + unordered_map<std::string, int> m; + m["a"] = 4; + m["ba"] = 6; + m["aabc"] = 7; + + for (auto i: m) { + cerr << i.first << "=" << i.second << " "; + } + + long sum = adder(1, 2, 3, 8, 7); + + std::string s1 = "x", s2 = "aa", s3 = "bb", s4 = "yy"; + std::string ssum = adder(s1, s2, s3, s4); + } |