blob: 1d7c1cb0ef0ec05d2bc56201e6299d450d8bf58c (
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
37
38
39
40
41
42
43
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vbench/test/all.h>
using namespace vbench;
TEST("untainted") {
Taint t;
bool fail = t;
EXPECT_FALSE(fail);
EXPECT_FALSE(t.taint());
EXPECT_EQUAL("", t.reason());
}
TEST("Taintable::nil") {
const Taint &t = Taintable::nil().tainted();
bool fail = t;
EXPECT_FALSE(fail);
EXPECT_FALSE(t.taint());
EXPECT_EQUAL("", t.reason());
}
TEST("tainted") {
Taint t("argh");
bool fail = t;
EXPECT_TRUE(fail);
EXPECT_TRUE(t.taint());
EXPECT_EQUAL("argh", t.reason());
}
TEST("reset taint") {
Taint t;
EXPECT_FALSE(t.taint());
EXPECT_EQUAL("", t.reason());
t.reset("argh");
EXPECT_TRUE(t.taint());
EXPECT_EQUAL("argh", t.reason());
t.reset();
EXPECT_FALSE(t.taint());
EXPECT_EQUAL("", t.reason());
}
TEST_MAIN() { TEST_RUN_ALL(); }
|