blob: 466e2b3e6931462596ee24c44b213997f4764b78 [file] [log] [blame]
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#include "test/testsupport/perf_test.h"
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +000012
13#include <string>
14
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "test/gtest.h"
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +000016
17namespace webrtc {
18namespace test {
19
20TEST(PerfTest, AppendResult) {
Edward Lemurf7ff3e82017-11-22 16:32:01 +010021 testing::internal::CaptureStdout();
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +000022 std::string expected = "RESULT measurementmodifier: trace= 42 units\n";
Edward Lemurf7ff3e82017-11-22 16:32:01 +010023 PrintResult("measurement", "modifier", "trace", 42, "units", false);
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +000024
25 expected += "*RESULT foobar: baz= 7 widgets\n";
Edward Lemur2f061682017-11-24 13:40:01 +010026 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 Lemurf7ff3e82017-11-22 16:32:01 +010033
34 std::string output = testing::internal::GetCapturedStdout();
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +000035 EXPECT_EQ(expected, output);
andrew@webrtc.org2009f6b2012-11-20 00:20:20 +000036}
37
38} // namespace test
39} // namespace webrtc