feat: refactor rename test() to run()
This commit is contained in:
parent
89d1469088
commit
88742436a1
10 changed files with 10 additions and 10 deletions
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
class ConstExpTest : public ChapterTest {
|
class ConstExpTest : public ChapterTest {
|
||||||
public:
|
public:
|
||||||
virtual void test() override;
|
virtual void run() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
class IfswitchTest : public ChapterTest {
|
class IfswitchTest : public ChapterTest {
|
||||||
public:
|
public:
|
||||||
virtual void test() override;
|
virtual void run() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
class InitListTest : public ChapterTest {
|
class InitListTest : public ChapterTest {
|
||||||
public:
|
public:
|
||||||
virtual void test() override;
|
virtual void run() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
class NullTest : public ChapterTest {
|
class NullTest : public ChapterTest {
|
||||||
public:
|
public:
|
||||||
virtual void test() override;
|
virtual void run() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ constexpr unsigned int fibonacci(const unsigned int n) {
|
||||||
return fibonacci(n - 2) + fibonacci(n - 1);
|
return fibonacci(n - 2) + fibonacci(n - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstExpTest::test() {
|
void ConstExpTest::run() {
|
||||||
std::cout << "Fibonacci(10): ";
|
std::cout << "Fibonacci(10): ";
|
||||||
for (const unsigned int n : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) {
|
for (const unsigned int n : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) {
|
||||||
std::cout << fibonacci(n) << " ";
|
std::cout << fibonacci(n) << " ";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "ifswitch.h"
|
#include "ifswitch.h"
|
||||||
|
|
||||||
void IfswitchTest::test() {
|
void IfswitchTest::run() {
|
||||||
std::vector<uint32_t> vec = {1, 2, 3, 4};
|
std::vector<uint32_t> vec = {1, 2, 3, 4};
|
||||||
|
|
||||||
if (auto it = std::find(vec.begin(), vec.end(), 23); it != vec.end()) {
|
if (auto it = std::find(vec.begin(), vec.end(), 23); it != vec.end()) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ public:
|
||||||
InitList(std::initializer_list<unsigned int> list) : _list(list) {}
|
InitList(std::initializer_list<unsigned int> list) : _list(list) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InitListTest::test() {
|
void InitListTest::run() {
|
||||||
|
|
||||||
InitList initList{1, 2, 3, 4, 5};
|
InitList initList{1, 2, 3, 4, 5};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ void call_test(char *) { std::cout << "call_test(char *) called" << std::endl; }
|
||||||
|
|
||||||
void call_test(int) { std::cout << "call_test(int) called" << std::endl; }
|
void call_test(int) { std::cout << "call_test(int) called" << std::endl; }
|
||||||
|
|
||||||
void NullTest::test() {
|
void NullTest::run() {
|
||||||
if (std::is_same<decltype(NULL), decltype(0)>::value) {
|
if (std::is_same<decltype(NULL), decltype(0)>::value) {
|
||||||
std::cout << "NULL == 0" << std::endl;
|
std::cout << "NULL == 0" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
class ChapterTest {
|
class ChapterTest {
|
||||||
public:
|
public:
|
||||||
virtual ~ChapterTest() = default;
|
virtual ~ChapterTest() = default;
|
||||||
virtual void test() = 0;
|
virtual void run() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
for (auto &[name, test] : chapterTests) {
|
for (auto &[name, test] : chapterTests) {
|
||||||
std::cout << "\n" << name << std::endl;
|
std::cout << "\n" << name << std::endl;
|
||||||
test->test();
|
test->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\nExiting" << std::endl;
|
std::cout << "\nExiting" << std::endl;
|
||||||
|
|
Loading…
Reference in a new issue