From 2833eb91ea1266f9bab8be8804ba945451f5b561 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Fri, 7 Jun 2019 14:10:47 +0100 Subject: [PATCH] base: Rename TestFiber into SwitchingFiber This is done since TestFiber is too generic and it is not the only Fiber's testing subclass in the unit test Change-Id: Idc386f487091ae9bdadae865090a6719a25583da Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19153 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- src/base/fiber.test.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/base/fiber.test.cc b/src/base/fiber.test.cc index 5ed13d425..7e7bfefe8 100644 --- a/src/base/fiber.test.cc +++ b/src/base/fiber.test.cc @@ -35,48 +35,48 @@ #include "base/fiber.hh" -class TestFiber : public Fiber +class SwitchingFiber : public Fiber { public: const char *name; std::vector next; - TestFiber(const char *name, std::initializer_list l); + SwitchingFiber(const char *name, std::initializer_list l); void checkExpected(); void main(); }; -extern TestFiber a; -extern TestFiber b; -extern TestFiber c; +extern SwitchingFiber a; +extern SwitchingFiber b; +extern SwitchingFiber c; -TestFiber a("A", { &b, &a, Fiber::primaryFiber(), &b, &c }); -TestFiber b("B", { &a, &c }); -TestFiber c("C", { &a, Fiber::primaryFiber(), Fiber::primaryFiber() }); +SwitchingFiber a("A", { &b, &a, Fiber::primaryFiber(), &b, &c }); +SwitchingFiber b("B", { &a, &c }); +SwitchingFiber c("C", { &a, Fiber::primaryFiber(), Fiber::primaryFiber() }); -std::vector::iterator expectedIt; -std::vector expected({ +std::vector::iterator expectedIt; +std::vector expected({ &a, &b, &a, &a, /* main Fiber, */ &a, &b, &c, &a, &c, /* main Fiber, */ &c, &c }); -TestFiber::TestFiber( +SwitchingFiber::SwitchingFiber( const char *name, std::initializer_list l) : name(name), next(l) {} void -TestFiber::checkExpected() +SwitchingFiber::checkExpected() { ASSERT_NE(expectedIt, expected.end()); - TestFiber *e = *expectedIt++; + SwitchingFiber *e = *expectedIt++; EXPECT_EQ(e, this) << "Expected " << e->name << ", got " << name; } void -TestFiber::main() +SwitchingFiber::main() { checkExpected(); for (auto &n : next) { -- 2.30.2