Sha256: bfc3fa4adfa97f694759b62989cacb78e865c25386a1b4bba2aca22914a2531d

Contents?: true

Size: 1.58 KB

Versions: 182

Compression:

Stored size: 1.58 KB

Contents

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

BOOST_AUTO_TEST_CASE(paired_square_brackets)
{
    BOOST_REQUIRE(bracket_push::check("[]"));
}

#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(empty_string)
{
    BOOST_REQUIRE(bracket_push::check(""));
}

BOOST_AUTO_TEST_CASE(unpaired_brackets)
{
    BOOST_REQUIRE(!bracket_push::check("[["));
}

BOOST_AUTO_TEST_CASE(wrong_ordered_brackets)
{
    BOOST_REQUIRE(!bracket_push::check("}{"));
}

BOOST_AUTO_TEST_CASE(wrong_closing_bracket)
{
    BOOST_REQUIRE(!bracket_push::check("{]"));
}

BOOST_AUTO_TEST_CASE(paired_with_whitespace)
{
    BOOST_REQUIRE(bracket_push::check("{ }"));
}

BOOST_AUTO_TEST_CASE(simple_nested_brackets)
{
    BOOST_REQUIRE(bracket_push::check("{[]}"));
}

BOOST_AUTO_TEST_CASE(several_paired_brackets)
{
    BOOST_REQUIRE(bracket_push::check("{}[]"));
}

BOOST_AUTO_TEST_CASE(paired_nested_brackets)
{
    BOOST_REQUIRE(bracket_push::check("([{}({}[])])"));
}

BOOST_AUTO_TEST_CASE(unopened_closing_brackets)
{
    BOOST_REQUIRE(!bracket_push::check("{[)][]}"));
}

BOOST_AUTO_TEST_CASE(unpaired_nested_brackets)
{
    BOOST_REQUIRE(!bracket_push::check("([{])"));
}

BOOST_AUTO_TEST_CASE(paired_wrong_nested_brackets)
{
    BOOST_REQUIRE(!bracket_push::check("[({]})"));
}

BOOST_AUTO_TEST_CASE(math_expression)
{
    BOOST_REQUIRE(bracket_push::check("(((185 + 223.85) * 15) - 543)/2"));
}

BOOST_AUTO_TEST_CASE(complex_latex_expression)
{
    BOOST_REQUIRE(bracket_push::check("\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)"));
}
#endif

Version data entries

182 entries across 182 versions & 1 rubygems

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