Sha256: 0ba19ff8ef6512791b1f7c665fda7a50c8d38bc1f9bdc4b17bc04698dcd098cc

Contents?: true

Size: 1.79 KB

Versions: 156

Compression:

Stored size: 1.79 KB

Contents

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

BOOST_AUTO_TEST_CASE(transforms_one_value)
{
    const std::map<int, std::vector<char>> old{{1, {'A'}}};

    const auto actual = etl::transform(old);

    const std::map<char, int> expected{{'a', 1}};
    REQUIRE_EQUAL_CONTAINERS(expected, actual);
}

#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(transforms_more_values)
{
    const std::map<int, std::vector<char>> old{{1, {'A', 'E', 'I', 'O', 'U'}}};

    const auto actual = etl::transform(old);

    const std::map<char, int> expected{{'a', 1}, {'e', 1}, {'i', 1}, {'o', 1}, {'u', 1}};
    REQUIRE_EQUAL_CONTAINERS(expected, actual);
}

BOOST_AUTO_TEST_CASE(transforms_more_keys)
{
    const std::map<int, std::vector<char>> old{{1, {'A', 'E'}}, {2, {'D', 'G'}}};

    const auto actual = etl::transform(old);

    const std::map<char, int> expected{{'a', 1}, {'e', 1}, {'d', 2}, {'g', 2}};
    REQUIRE_EQUAL_CONTAINERS(expected, actual);
}

BOOST_AUTO_TEST_CASE(transforms_a_full_dataset)
{
    const std::map<int, std::vector<char>> old{
        {1, {'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'}},
        {2, {'D', 'G'}},
        {3, {'B', 'C', 'M', 'P'}},
        {4, {'F', 'H', 'V', 'W', 'Y'}},
        {5, {'K'}},
        {8, {'J', 'X'}},
        {10, {'Q', 'Z'}}
    };

    const auto actual = etl::transform(old);

    const std::map<char, int> expected{
        {'a', 1}, {'b', 3},  {'c', 3}, {'d', 2}, {'e', 1},
        {'f', 4}, {'g', 2},  {'h', 4}, {'i', 1}, {'j', 8},
        {'k', 5}, {'l', 1},  {'m', 3}, {'n', 1}, {'o', 1},
        {'p', 3}, {'q', 10}, {'r', 1}, {'s', 1}, {'t', 1},
        {'u', 1}, {'v', 4},  {'w', 4}, {'x', 8}, {'y', 4},
        {'z', 10}
    };
    REQUIRE_EQUAL_CONTAINERS(expected, actual);
}
#endif

Version data entries

156 entries across 156 versions & 1 rubygems

Version Path
trackler-2.1.0.0 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.55 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.54 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.53 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.52 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.51 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.50 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.49 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.48 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.47 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.46 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.45 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.44 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.43 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.42 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.41 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.40 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.39 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.38 tracks/cpp/exercises/etl/etl_test.cpp
trackler-2.0.8.37 tracks/cpp/exercises/etl/etl_test.cpp