blob: 967969b6b83578fc911144fb025a3a5ef4dc6032 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "catch.hpp"
#include <history.h>
using namespace newsbeuter;
TEST_CASE("History can be iterated on in any direction", "[history]") {
history h;
SECTION("Empty history returns nothing") {
REQUIRE(h.prev() == "");
REQUIRE(h.prev() == "");
REQUIRE(h.next() == "");
REQUIRE(h.next() == "");
SECTION("One line in history") {
h.add_line("testline");
REQUIRE(h.prev() == "testline");
REQUIRE(h.prev() == "testline");
REQUIRE(h.next() == "testline");
REQUIRE(h.next() == "");
SECTION("Two lines in history") {
h.add_line("foobar");
REQUIRE(h.prev() == "foobar");
REQUIRE(h.prev() == "testline");
REQUIRE(h.next() == "testline");
REQUIRE(h.prev() == "testline");
REQUIRE(h.next() == "testline");
REQUIRE(h.next() == "foobar");
REQUIRE(h.next() == "");
REQUIRE(h.next() == "");
}
}
}
}
|