summaryrefslogtreecommitdiff
path: root/fast/test/test_sparse_vector.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-23 22:59:16 +0100
committerPatrick Simianer <p@simianer.de>2014-08-23 22:59:16 +0100
commitcef65063cec641a93973b38a48e100fdd115db44 (patch)
tree32d5f10757e021a9fad01156fbff62a96212f006 /fast/test/test_sparse_vector.cc
parent190f68c880eb27506669e95e2bc0493e2ec42c4c (diff)
rewritten grammar
Diffstat (limited to 'fast/test/test_sparse_vector.cc')
-rw-r--r--fast/test/test_sparse_vector.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/fast/test/test_sparse_vector.cc b/fast/test/test_sparse_vector.cc
new file mode 100644
index 0000000..426bed1
--- /dev/null
+++ b/fast/test/test_sparse_vector.cc
@@ -0,0 +1,37 @@
+#include "sparse_vector.hh"
+
+
+int
+main(void)
+{
+ Sv::SparseVector<string, score_t> a;
+ a.insert("1", 1);
+ a.insert("2", 2);
+ cout << "a:" << a << endl;
+
+ Sv::SparseVector<string, score_t> b;
+ b.insert("2", 2);
+ cout << "b:" << b << endl;
+
+ Sv::SparseVector<string, score_t> c = a + b;
+ cout << "a+b:" << c << endl;
+
+ a += b;
+ cout << "a+=b:" << a << endl;
+
+ a -= b;
+ cout << "a-=b:" << a << endl;
+
+ cout << "a*2:" << a*2 << endl;
+
+ a *= 2;
+ cout << "a*=2:" << a << endl;
+
+ string s("\"a\"=2 \"b\"=3");
+ Sv::SparseVector<string, score_t>* sv = new Sv::SparseVector<string, score_t>(s);
+ cout << *sv << endl;
+ cout << sv->dot(*sv) << endl;
+
+ return 0;
+}
+