-
Notifications
You must be signed in to change notification settings - Fork 3
/
TestSlim.cpp
35 lines (27 loc) · 1.08 KB
/
TestSlim.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Copyright (C) 2013 by Konstantin (Kosta) Baumann. All Rights Reserved.
//
#include "fitnesse/cppslim/DecisionFixture.h"
#include "fitnesse/cppslim/Registry.h"
SLIM_DEFINE_FIXTURE(TestSlim) {
static void RegisterMethods() {
RegisterCtor0();
RegisterCtor1<std::string>();
RegisterMethod("createTestSlimWithString", &TestSlim::createTestSlimWithString);
RegisterMember("stringArg", &TestSlim::stringArg);
RegisterMethod("isSame", &TestSlim::isSame);
RegisterMethod("stringArgFromOther", &TestSlim::stringArgFromOther);
}
TestSlim(std::string a = "") : stringArg(a) { }
std::string stringArg;
std::shared_ptr<TestSlim> createTestSlimWithString(std::string test) {
return std::make_shared<TestSlim>(test);
}
bool isSame(std::shared_ptr<const TestSlim> obj) const {
return (this == obj.get());
}
std::string stringArgFromOther(std::shared_ptr<const TestSlim> obj) const {
if(!obj) { return "<null>"; }
return obj->stringArg;
}
};