mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-30 14:22:28 -06:00
Bazzar: Google test example packages naming simplification.
git-svn-id: svn://ultimatepp.org/upp/trunk@14993 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e39620c940
commit
eee1bd4e46
13 changed files with 27 additions and 28 deletions
|
|
@ -1,54 +0,0 @@
|
|||
#include <plugin/gmock/gmock.h>
|
||||
#include <plugin/gtest/gtest.h>
|
||||
|
||||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
const String CAR_REGISTRATION_NUMBER = "UPP IS THE BEST";
|
||||
|
||||
class Car {
|
||||
public:
|
||||
virtual ~Car() = default;
|
||||
|
||||
virtual void OpenHood() = 0;
|
||||
virtual String ReadRegistrationNumbers() const = 0;
|
||||
};
|
||||
|
||||
class MockCar final : public Car {
|
||||
public:
|
||||
MOCK_METHOD(void, OpenHood, (), (override));
|
||||
MOCK_METHOD(String, ReadRegistrationNumbers, (), (const, override));
|
||||
};
|
||||
|
||||
class CarRepairShop final {
|
||||
public:
|
||||
CarRepairShop()
|
||||
: carsWaitingForService({ CAR_REGISTRATION_NUMBER })
|
||||
{}
|
||||
|
||||
bool Service(Car& car) {
|
||||
if (carsWaitingForService.Find(car.ReadRegistrationNumbers()) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
car.OpenHood();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Index<String> carsWaitingForService;
|
||||
};
|
||||
|
||||
TEST(CarRepairShopTest, ServiceChecksAllMainCarElements) {
|
||||
MockCar car;
|
||||
CarRepairShop repairShop;
|
||||
|
||||
EXPECT_CALL(car, ReadRegistrationNumbers()).WillOnce(::testing::Return(String(CAR_REGISTRATION_NUMBER)));
|
||||
EXPECT_CALL(car, OpenHood()).Times(::testing::AtLeast(1));
|
||||
|
||||
EXPECT_TRUE(repairShop.Service(car));
|
||||
}
|
||||
|
||||
TEST_APP_MAIN {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue