feat: add structured binding test

This commit is contained in:
Michael Mandl 2023-10-21 17:11:05 +02:00
parent 88742436a1
commit 543b4b832a
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7
4 changed files with 36 additions and 11 deletions

View file

@ -1,13 +1,13 @@
#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include "constexp.h"
#include "ifswitch.h"
#include "initlist.h"
#include "null.h"
#include "structured_binding.h"
#include "version.h"
int main(int argc, char **argv) {
@ -15,16 +15,21 @@ int main(int argc, char **argv) {
std::cout << "Running " << PROJECT_NAME << ", version " << VERSION << "\n"
<< std::endl;
std::vector<std::tuple<std::string, std::unique_ptr<ChapterTest>>>
chapterTests;
chapterTests.emplace_back("Null test", std::make_unique<NullTest>());
chapterTests.emplace_back("If/Switch test", std::make_unique<IfswitchTest>());
chapterTests.emplace_back("Constexpr test", std::make_unique<ConstExpTest>());
chapterTests.emplace_back("Initializer list test",
std::make_unique<InitListTest>());
std::vector<std::tuple<const char *, std::unique_ptr<ChapterTest>>>
chapter_2_tests;
for (auto &[name, test] : chapterTests) {
std::cout << "\n" << name << std::endl;
chapter_2_tests.emplace_back("Nullptr test", std::make_unique<NullTest>());
chapter_2_tests.emplace_back("If/Switch test",
std::make_unique<IfswitchTest>());
chapter_2_tests.emplace_back("Constexpr test",
std::make_unique<ConstExpTest>());
chapter_2_tests.emplace_back("Initializer list test",
std::make_unique<InitListTest>());
chapter_2_tests.emplace_back("Structured binding test",
std::make_unique<StructuredBindingTest>());
for (auto &[test_description, test] : chapter_2_tests) {
std::cout << "\n" << test_description << ":" << std::endl;
test->run();
}