blob: 6a8f8f3cbac70fbf10842cb62a7813655e4e0009 (
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 "3rd-party/catch.hpp"
#include <history.h>
using namespace newsboat;
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() == "");
}
}
}
}
|