summaryrefslogtreecommitdiff
path: root/fast/test_sparse_vector.cc
diff options
context:
space:
mode:
Diffstat (limited to 'fast/test_sparse_vector.cc')
-rw-r--r--fast/test_sparse_vector.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/fast/test_sparse_vector.cc b/fast/test_sparse_vector.cc
new file mode 100644
index 0000000..f486486
--- /dev/null
+++ b/fast/test_sparse_vector.cc
@@ -0,0 +1,32 @@
+#include "sparse_vector.hh"
+
+
+int
+main(void)
+{
+ Sv::SparseVector<string, weight_t> a;
+ a.insert("1", 1);
+ a.insert("2", 2);
+ cout << "a:" << a << endl;
+
+ Sv::SparseVector<string, weight_t> b;
+ b.insert("2", 2);
+ cout << "b:" << b << endl;
+
+ Sv::SparseVector<string, weight_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;
+
+ return 0;
+}
+