summaryrefslogtreecommitdiff
path: root/utils/sv_test.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-11-25 23:24:42 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-11-25 23:24:42 +0000
commit2b95390f08d9f556e6207ecff03b4b0fd5ede993 (patch)
tree7a96e837a3e28cfc8258a3c5293ac333d7c3e29e /utils/sv_test.cc
parent467ef6ce78cfe7341a696ebf0948e377be619ae5 (diff)
parent62a2526e69eb1570bf349763fc8bb65179337918 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'utils/sv_test.cc')
-rw-r--r--utils/sv_test.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/sv_test.cc b/utils/sv_test.cc
new file mode 100644
index 00000000..c7ac9e54
--- /dev/null
+++ b/utils/sv_test.cc
@@ -0,0 +1,24 @@
+#define BOOST_TEST_MODULE WeightsTest
+#include <boost/test/unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+#include "sparse_vector.h"
+
+using namespace std;
+
+BOOST_AUTO_TEST_CASE(Equality) {
+ SparseVector<double> x;
+ SparseVector<double> y;
+ x.set_value(1,-1);
+ y.set_value(1,-1);
+ BOOST_CHECK(x == y);
+}
+
+BOOST_AUTO_TEST_CASE(Division) {
+ SparseVector<double> x;
+ SparseVector<double> y;
+ x.set_value(1,1);
+ y.set_value(1,-1);
+ BOOST_CHECK(!(x == y));
+ x /= -1;
+ BOOST_CHECK(x == y);
+}