gem5 v24.0.0.0
Loading...
Searching...
No Matches
units.test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Daniel R. Carvalho
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <gtest/gtest-spi.h>
30#include <gtest/gtest.h>
31
32#include "base/stats/units.hh"
33
34using namespace gem5;
35
36TEST(StatsUnitsTest, Cycle)
37{
40}
41
42TEST(StatsUnitsTest, Tick)
43{
44 statistics::units::Tick *unit = statistics::units::Tick::get();
45 ASSERT_EQ(unit->getUnitString(), statistics::units::Tick::toString());
46}
47
48TEST(StatsUnitsTest, Second)
49{
52}
53
54TEST(StatsUnitsTest, Bit)
55{
58}
59
60TEST(StatsUnitsTest, Byte)
61{
64}
65
66TEST(StatsUnitsTest, Watt)
67{
70}
71
72TEST(StatsUnitsTest, Joule)
73{
76}
77
78TEST(StatsUnitsTest, Volt)
79{
82}
83
84TEST(StatsUnitsTest, DegreeCelsius)
85{
88 ASSERT_EQ(unit->getUnitString(),
90}
91
92TEST(StatsUnitsTest, Count)
93{
96}
97
98TEST(StatsUnitsTest, Rate1)
99{
104 ASSERT_EQ(unit->getUnitString(), "(Count/Count)");
105 ASSERT_EQ(unit->getUnitString(),
107 statistics::units::Count>::toString()));
108}
109
110TEST(StatsUnitsTest, Rate2)
111{
116 ASSERT_EQ(unit->getUnitString(), "(Tick/Second)");
117 ASSERT_EQ(unit->getUnitString(),
119 statistics::units::Second>::toString()));
120}
121
134
135TEST(StatsUnitsTest, Ratio)
136{
139}
140
141TEST(StatsUnitsTest, Unspecified)
142{
145 ASSERT_EQ(unit->getUnitString(),
147}
static std::string toString()
Definition units.hh:190
std::string getUnitString() const override
Definition units.hh:191
std::string getUnitString() const override
Definition units.hh:208
static std::string toString()
Definition units.hh:207
std::string getUnitString() const override
Definition units.hh:299
static std::string toString()
Definition units.hh:298
static std::string toString()
Definition units.hh:139
std::string getUnitString() const override
Definition units.hh:140
std::string getUnitString() const override
Definition units.hh:278
static DegreeCelsius * get()
Definition units.hh:271
static std::string toString()
Definition units.hh:276
std::string getUnitString() const override
Definition units.hh:243
static std::string toString()
Definition units.hh:242
static Rate< T1, T2 > * get()
Definition units.hh:358
std::string getUnitString() const override
Definition units.hh:369
static std::string toString()
Definition units.hh:315
std::string getUnitString() const override
Definition units.hh:316
std::string getUnitString() const override
Definition units.hh:174
static std::string toString()
Definition units.hh:173
static Second * get()
Definition units.hh:168
std::string getUnitString() const override
Definition units.hh:157
static std::string toString()
Definition units.hh:332
std::string getUnitString() const override
Definition units.hh:334
static Unspecified * get()
Definition units.hh:327
std::string getUnitString() const override
Definition units.hh:260
static std::string toString()
Definition units.hh:259
static std::string toString()
Definition units.hh:224
std::string getUnitString() const override
Definition units.hh:225
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58
TEST(StatsUnitsTest, Cycle)
Definition units.test.cc:36

Generated on Tue Jun 18 2024 16:24:01 for gem5 by doxygen 1.11.0