[9529] | 1 | #include <gtest/gtest.h> |
---|
| 2 | #include "util/Output.h" |
---|
| 3 | |
---|
| 4 | namespace orxonox |
---|
| 5 | { |
---|
| 6 | namespace context |
---|
| 7 | { |
---|
| 8 | namespace |
---|
| 9 | { |
---|
| 10 | REGISTER_OUTPUT_CONTEXT(unittest); |
---|
| 11 | } |
---|
| 12 | } |
---|
| 13 | |
---|
[9533] | 14 | TEST(OutputTest, CanUseOrxout) |
---|
[9529] | 15 | { |
---|
| 16 | orxout() << "test" << endl; |
---|
| 17 | } |
---|
| 18 | |
---|
[9533] | 19 | TEST(OutputTest, OrxoutUsesCorrectOutputLevel) |
---|
[9529] | 20 | { |
---|
| 21 | { |
---|
| 22 | const OutputStream& stream = orxout(internal_warning); |
---|
| 23 | EXPECT_EQ(internal_warning, stream.getOutputLevel()); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | { |
---|
| 27 | const OutputStream& stream = orxout(debug_output); |
---|
| 28 | EXPECT_EQ(debug_output, stream.getOutputLevel()); |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
[9533] | 32 | TEST(OutputTest, OrxoutUsesCorrectOutputContext) |
---|
[9529] | 33 | { |
---|
| 34 | const OutputStream& stream = orxout(verbose, context::unittest()); |
---|
| 35 | EXPECT_EQ(verbose, stream.getOutputLevel()); |
---|
| 36 | EXPECT_EQ(context::unittest().mask, stream.getOutputContext()->mask); |
---|
| 37 | EXPECT_EQ(context::unittest().name, stream.getOutputContext()->name); |
---|
| 38 | EXPECT_EQ(context::unittest().sub_id, stream.getOutputContext()->sub_id); |
---|
| 39 | } |
---|
| 40 | |
---|
[9533] | 41 | TEST(OutputTest, OrxoutAcceptsFunctionPointer) |
---|
[9529] | 42 | { |
---|
| 43 | const OutputStream& stream = orxout(verbose, context::unittest); |
---|
| 44 | EXPECT_EQ(verbose, stream.getOutputLevel()); |
---|
| 45 | EXPECT_EQ(context::unittest().mask, stream.getOutputContext()->mask); |
---|
| 46 | EXPECT_EQ(context::unittest().name, stream.getOutputContext()->name); |
---|
| 47 | EXPECT_EQ(context::unittest().sub_id, stream.getOutputContext()->sub_id); |
---|
| 48 | } |
---|
| 49 | } |
---|