Sha256: 24146b1b20802640a4f364d331fe510b8da8efc3f76ec6191f22923ca195d7ad

Contents?: true

Size: 1.06 KB

Versions: 37

Compression:

Stored size: 1.06 KB

Contents

#include "unittest.hpp"
#include "rice/Symbol.hpp"
#include "rice/Identifier.hpp"

using namespace Rice;

TESTSUITE(Symbol);

SETUP(Symbol)
{
  ruby_init();
}

TESTCASE(construct_from_symbol)
{
  VALUE v = ID2SYM(rb_intern("foo"));
  Symbol symbol(v);
  ASSERT_EQUAL(v, symbol.value());
}

TESTCASE(construct_from_identifier)
{
  Identifier identifier("FOO");
  Symbol symbol(identifier);
  ASSERT_EQUAL(ID2SYM(rb_intern("FOO")), symbol.value());
}

TESTCASE(construct_from_string)
{
  Symbol symbol("Foo");
  ASSERT_EQUAL(ID2SYM(rb_intern("Foo")), symbol.value());
}

TESTCASE(default_construct)
{
  Symbol symbol;
  ASSERT_EQUAL(ID2SYM(rb_intern("")), symbol.value());
}

TESTCASE(copy_construct)
{
  Symbol symbol1("Foo");
  Symbol symbol2(symbol1);
  ASSERT_EQUAL(ID2SYM(rb_intern("Foo")), symbol2.value());
}

TESTCASE(c_str)
{
  Symbol symbol("Foo");
  ASSERT_EQUAL("Foo", symbol.c_str());
}

TESTCASE(str)
{
  Symbol symbol("Foo");
  ASSERT_EQUAL(std::string("Foo"), symbol.str());
}

TESTCASE(to_id)
{
  Symbol symbol("Foo");
  ASSERT_EQUAL(Identifier("Foo"), symbol.to_id());
}

Version data entries

37 entries across 37 versions & 6 rubygems

Version Path
rice2-2.2.1 test/test_Symbol.cpp
rice2-2.2.0 test/test_Symbol.cpp
rice-2.2.0 test/test_Symbol.cpp
rice-2.1.3 test/test_Symbol.cpp
rice-2.1.2 test/test_Symbol.cpp
rice-2.1.1 test/test_Symbol.cpp
rice-2.1.0 test/test_Symbol.cpp
rice-2.0.0 test/test_Symbol.cpp
rice-1.7.0 test/test_Symbol.cpp
rice-1.6.3 test/test_Symbol.cpp
jameskilton-rice-1.2.0 test/test_Symbol.cpp
rice-1.6.2 test/test_Symbol.cpp
rice-1.6.1 test/test_Symbol.cpp
rice-1.6.0 test/test_Symbol.cpp
rice-1.6.0.pre test/test_Symbol.cpp
rice-1.5.3 test/test_Symbol.cpp
rice-1.5.2 test/test_Symbol.cpp
keyme-rice-1.5.1.keyme1 test/test_Symbol.cpp
keyme-rice-1.5.1.keyme test/test_Symbol.cpp
rice-1.5.1 test/test_Symbol.cpp