Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-06-28 21:20:42 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-06-28 21:20:42 +0300
commitf7c3d00824e1664ba0cbfbc80ff94a82f3eb7561 (patch)
tree3d20421d068b4c87ed8df5315ea00ea720cb48a1 /phrase-extract
parentf66beabf4f0dca33a6bbcc37072811e9017e19b5 (diff)
more testing of c++11 waters
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/ScoreFeatureTest.cpp28
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);
+
}