diff options
Diffstat (limited to 'vbench/src/tests/taint/taint_test.cpp')
-rw-r--r-- | vbench/src/tests/taint/taint_test.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vbench/src/tests/taint/taint_test.cpp b/vbench/src/tests/taint/taint_test.cpp new file mode 100644 index 00000000000..1d7c1cb0ef0 --- /dev/null +++ b/vbench/src/tests/taint/taint_test.cpp @@ -0,0 +1,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(); } |