Sha256: afa5b6dc9c9233878388b956e737a0ee20f9200ba98b470af3e4c29daa858d83
Contents?: true
Size: 1.24 KB
Versions: 37
Compression:
Stored size: 1.24 KB
Contents
#include "unittest.hpp" #include "rice/Identifier.hpp" #include "rice/Symbol.hpp" using namespace Rice; TESTSUITE(Identifier); SETUP(Identifier) { ruby_init(); } TESTCASE(construct_from_id) { ID id = rb_intern("foo"); Identifier identifier(id); ASSERT_EQUAL(id, identifier.id()); } TESTCASE(construct_from_symbol) { Symbol symbol("FOO"); Identifier identifier(symbol); ASSERT_EQUAL(rb_intern("FOO"), identifier.id()); } TESTCASE(construct_from_c_string) { Identifier identifier("Foo"); ASSERT_EQUAL(rb_intern("Foo"), identifier.id()); } TESTCASE(default_construct) { Identifier identifier; ASSERT_EQUAL(rb_intern(""), identifier.id()); } TESTCASE(copy_construct) { Identifier identifier1("Foo"); Identifier identifier2(identifier1); ASSERT_EQUAL(rb_intern("Foo"), identifier2.id()); } TESTCASE(c_str) { Identifier identifier("Foo"); ASSERT_EQUAL("Foo", identifier.c_str()); } TESTCASE(str) { Identifier identifier("Foo"); ASSERT_EQUAL(std::string("Foo"), identifier.str()); } TESTCASE(implicit_conversion_to_id) { Identifier identifier("Foo"); ASSERT_EQUAL(rb_intern("Foo"), static_cast<ID>(identifier)); } TESTCASE(to_sym) { Identifier identifier("Foo"); ASSERT_EQUAL(Symbol("Foo"), Symbol(identifier.to_sym())); }
Version data entries
37 entries across 37 versions & 6 rubygems