diff options
author | 2011-03-20 14:14:07 +0000 | |
---|---|---|
committer | 2011-03-20 16:20:41 +0000 | |
commit | 340d571281f94c4be93d34c66abe9f1439137a49 (patch) | |
tree | 1358d1faa0fef9d12fa81d0d9fe5374bda1f5551 | |
parent | 59c03f99c2056d2aa36f54a28146c686349d800a (diff) | |
download | paludis-340d571281f94c4be93d34c66abe9f1439137a49.tar.gz paludis-340d571281f94c4be93d34c66abe9f1439137a49.tar.xz |
gtest more
-rw-r--r-- | paludis/util/files.m4 | 2 | ||||
-rw-r--r-- | paludis/util/simple_parser_TEST.cc | 38 |
2 files changed, 15 insertions, 25 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index 1c06a8088..d5d8550e3 100644 --- a/paludis/util/files.m4 +++ b/paludis/util/files.m4 @@ -76,7 +76,7 @@ add(`sequence', `hh', `fwd', `impl', `cc') add(`set', `hh', `fwd', `impl', `cc') add(`sha1', `hh', `cc', `test') add(`sha256', `hh', `cc', `test') -add(`simple_parser', `hh', `cc', `test', `fwd') +add(`simple_parser', `hh', `cc', `gtest', `fwd') add(`singleton', `hh', `impl', `gtest') add(`stringify', `hh', `gtest') add(`string_list_stream', `hh', `cc', `fwd', `gtest') diff --git a/paludis/util/simple_parser_TEST.cc b/paludis/util/simple_parser_TEST.cc index e6d285a41..8d913f8f2 100644 --- a/paludis/util/simple_parser_TEST.cc +++ b/paludis/util/simple_parser_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009 Ciaran McCreesh + * Copyright (c) 2009, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -18,33 +18,23 @@ */ #include <paludis/util/simple_parser.hh> -#include <test/test_runner.hh> -#include <test/test_framework.hh> -#include <test/test_concepts.hh> + +#include <gtest/gtest.h> using namespace paludis; -using namespace test; -namespace test_cases +TEST(SimpleParser, Works) { - struct TestSimpleParserIgnoreCase : TestCase - { - TestSimpleParserIgnoreCase() : TestCase("ignore case") { } - - void run() - { - std::string text("oneTWOthree"), one, two, three; - SimpleParser parser(text); - TEST_CHECK(parser.consume(simple_parser::exact("one") >> one)); - TEST_CHECK(parser.consume(simple_parser::exact_ignoring_case("two") >> two)); - TEST_CHECK(! parser.consume(simple_parser::exact("THREE") >> three)); - TEST_CHECK(parser.consume(simple_parser::exact_ignoring_case("THREE") >> three)); + std::string text("oneTWOthree"), one, two, three; + SimpleParser parser(text); + ASSERT_TRUE(parser.consume(simple_parser::exact("one") >> one)); + ASSERT_TRUE(parser.consume(simple_parser::exact_ignoring_case("two") >> two)); + ASSERT_TRUE(! parser.consume(simple_parser::exact("THREE") >> three)); + ASSERT_TRUE(parser.consume(simple_parser::exact_ignoring_case("THREE") >> three)); - TEST_CHECK(parser.eof()); - TEST_CHECK_EQUAL(one, "one"); - TEST_CHECK_EQUAL(two, "TWO"); - TEST_CHECK_EQUAL(three, "three"); - } - } test_ignore_case; + ASSERT_TRUE(parser.eof()); + EXPECT_EQ("one", one); + EXPECT_EQ("TWO", two); + EXPECT_EQ("three", three); } |