feat: refactor rename test() to run()
This commit is contained in:
parent
89d1469088
commit
88742436a1
@ -4,5 +4,5 @@
|
||||
|
||||
class ConstExpTest : public ChapterTest {
|
||||
public:
|
||||
virtual void test() override;
|
||||
virtual void run() override;
|
||||
};
|
||||
|
@ -4,5 +4,5 @@
|
||||
|
||||
class IfswitchTest : public ChapterTest {
|
||||
public:
|
||||
virtual void test() override;
|
||||
virtual void run() override;
|
||||
};
|
||||
|
@ -4,5 +4,5 @@
|
||||
|
||||
class InitListTest : public ChapterTest {
|
||||
public:
|
||||
virtual void test() override;
|
||||
virtual void run() override;
|
||||
};
|
||||
|
@ -4,5 +4,5 @@
|
||||
|
||||
class NullTest : public ChapterTest {
|
||||
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);
|
||||
}
|
||||
|
||||
void ConstExpTest::test() {
|
||||
void ConstExpTest::run() {
|
||||
std::cout << "Fibonacci(10): ";
|
||||
for (const unsigned int n : {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) {
|
||||
std::cout << fibonacci(n) << " ";
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "ifswitch.h"
|
||||
|
||||
void IfswitchTest::test() {
|
||||
void IfswitchTest::run() {
|
||||
std::vector<uint32_t> vec = {1, 2, 3, 4};
|
||||
|
||||
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) {}
|
||||
};
|
||||
|
||||
void InitListTest::test() {
|
||||
void InitListTest::run() {
|
||||
|
||||
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 NullTest::test() {
|
||||
void NullTest::run() {
|
||||
if (std::is_same<decltype(NULL), decltype(0)>::value) {
|
||||
std::cout << "NULL == 0" << std::endl;
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
class ChapterTest {
|
||||
public:
|
||||
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) {
|
||||
std::cout << "\n" << name << std::endl;
|
||||
test->test();
|
||||
test->run();
|
||||
}
|
||||
|
||||
std::cout << "\nExiting" << std::endl;
|
||||
|
Reference in New Issue
Block a user