Permalink
Browse files

Add test for array, hash conversions

  • Loading branch information...
1 parent cd937be commit 53a751b5c38715b5d1b6c8e714ccb86641090193 Matthew King committed Apr 12, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 test/test_To_From_Ruby.cpp
View
26 test/test_To_From_Ruby.cpp
@@ -1,6 +1,8 @@
#include "unittest.hpp"
#include "rice/to_from_ruby.hpp"
#include "rice/String.hpp"
+#include "rice/Array.hpp"
+#include "rice/Hash.hpp"
#include <limits>
#include <cmath>
@@ -275,3 +277,27 @@ TESTCASE(std_string_from_ruby_with_binary)
ASSERT_EQUAL(5, got.length());
ASSERT_EQUAL(std::string("\000test", 5), got);
}
+
+TESTCASE(array_to_ruby)
+{
+ Array a(rb_ary_new());
+ ASSERT_EQUAL(a.value(), to_ruby(a).value());
+}
+
+TESTCASE(array_from_ruby)
+{
+ Array a(rb_ary_new());
+ ASSERT_EQUAL(a.value(), from_ruby<Array>(a).value());
+}
+
+TESTCASE(hash_to_ruby)
+{
+ Hash h(rb_hash_new());
+ ASSERT_EQUAL(h.value(), to_ruby(h).value());
+}
+
+TESTCASE(hash_from_ruby)
+{
+ Hash h(rb_hash_new());
+ ASSERT_EQUAL(h.value(), from_ruby<Hash>(h).value());
+}

0 comments on commit 53a751b

Please sign in to comment.