Sha256: 7ebc3c32984ad94262882c03d163ec7bcfa9fc5fe41e8f556865150dbedc89c1

Contents?: true

Size: 1.17 KB

Versions: 396

Compression:

Stored size: 1.17 KB

Contents

#include "hexadecimal.h"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE(hex_1_is_decimal_1)
{
    BOOST_REQUIRE_EQUAL(0x1, hexadecimal::convert("1"));
}

#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(hex_c_is_decimal_12)
{
    BOOST_REQUIRE_EQUAL(0xc, hexadecimal::convert("c"));
}

BOOST_AUTO_TEST_CASE(hex_10_is_decimal_16)
{
    BOOST_REQUIRE_EQUAL(0x10, hexadecimal::convert("10"));
}

BOOST_AUTO_TEST_CASE(hex_af_is_decimal_175)
{
    BOOST_REQUIRE_EQUAL(0xaf, hexadecimal::convert("af"));
}

BOOST_AUTO_TEST_CASE(hex_100_is_decimal_256)
{
    BOOST_REQUIRE_EQUAL(0x100, hexadecimal::convert("100"));
}

BOOST_AUTO_TEST_CASE(hex_19ace_is_decimal_105166)
{
    BOOST_REQUIRE_EQUAL(0x19ace, hexadecimal::convert("19ace"));
}

BOOST_AUTO_TEST_CASE(invalid_hex_is_decimal_0)
{
    BOOST_REQUIRE_EQUAL(0, hexadecimal::convert("carrot"));
}

BOOST_AUTO_TEST_CASE(black)
{
    BOOST_REQUIRE_EQUAL(0x000000, hexadecimal::convert("000000"));
}

BOOST_AUTO_TEST_CASE(white)
{
    BOOST_REQUIRE_EQUAL(0xffffff, hexadecimal::convert("ffffff"));
}

BOOST_AUTO_TEST_CASE(yellow)
{
    BOOST_REQUIRE_EQUAL(0xffff00, hexadecimal::convert("ffff00"));
}
#endif

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.179 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.178 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.177 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.176 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.175 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.174 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.173 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.172 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.171 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.170 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.169 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.167 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.166 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.165 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.164 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.163 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.162 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.161 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp
trackler-2.2.1.160 tracks/cpp/exercises/hexadecimal/hexadecimal_test.cpp