Skip to content

Commit c579777

Browse files
committed
Fix tests
1 parent e01baf9 commit c579777

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

test/simulator/format/time_format_test.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66

77
TEST(TimeFormatTest, DefaultPrecision) {
88
// default precision
9-
Time<Nanosecond> byte(1.23456);
10-
EXPECT_EQ(fmt::format("{}", byte), "1.2ns");
11-
}
12-
13-
TEST(TimeFormatTest, LargeValue) {
14-
// use large value
15-
Time<Millisecond> t(1e9);
16-
EXPECT_EQ(fmt::format("{}", t), "1000000000.0ms");
9+
Time<Nanosecond> ns(1);
10+
EXPECT_EQ(fmt::format("{}", ns), "1.0ns");
1711
}
1812

1913
TEST(TimeFormatTest, CustomPrecision) {
20-
// specify precision
21-
Time<Second> t(1.23456);
22-
EXPECT_EQ(fmt::format("{:.1f}", t), "1.2s");
23-
EXPECT_EQ(fmt::format("{:.4f}", t), "1.2346s");
14+
// custom precision
15+
Time<Microsecond> t(Time<Nanosecond>(230));
16+
EXPECT_EQ(fmt::format("{}", t), "0.2us");
17+
EXPECT_EQ(fmt::format("{:.2f}", t), "0.23us");
2418
}

0 commit comments

Comments
 (0)