andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "test/testsupport/perf_test.h" |
andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 12 | |
| 13 | #include <string> |
| 14 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 15 | #include "test/gtest.h" |
andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | namespace test { |
| 19 | |
| 20 | TEST(PerfTest, AppendResult) { |
Edward Lemur | f7ff3e8 | 2017-11-22 16:32:01 +0100 | [diff] [blame] | 21 | testing::internal::CaptureStdout(); |
andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 22 | std::string expected = "RESULT measurementmodifier: trace= 42 units\n"; |
Edward Lemur | f7ff3e8 | 2017-11-22 16:32:01 +0100 | [diff] [blame] | 23 | PrintResult("measurement", "modifier", "trace", 42, "units", false); |
andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 24 | |
| 25 | expected += "*RESULT foobar: baz= 7 widgets\n"; |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 26 | PrintResult("foo", "bar", "baz", 7, "widgets", true); |
| 27 | |
| 28 | expected += "RESULT foobar: baz= {1,2} lemurs\n"; |
| 29 | PrintResultMeanAndError("foo", "bar", "baz", 1, 2, "lemurs", false); |
| 30 | |
| 31 | expected += "RESULT foobar: baz= [1,2,3] units\n"; |
| 32 | PrintResultList("foo", "bar", "baz", {1, 2, 3}, "units", false); |
Edward Lemur | f7ff3e8 | 2017-11-22 16:32:01 +0100 | [diff] [blame] | 33 | |
| 34 | std::string output = testing::internal::GetCapturedStdout(); |
andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 35 | EXPECT_EQ(expected, output); |
andrew@webrtc.org | 2009f6b | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | } // namespace test |
| 39 | } // namespace webrtc |