/
thomas-king
/
ArgumentsParser
Обзор
Документация
Войти
/
thomas-king
/
ArgumentsParser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
lib/Tests/ArgumentsParserTests.cpp
54 строки
2 KB
Ace Rodstin
Fix tests
20 ноя 2023, 21:08
20 ноя 2023, 21:08
9e5189b
Код
Авторство
О чём код?
// // ArgumentsParserTests.cpp // ArgumentsParser // // Created by Ace Rodstin on 11/13/23. // Updated by Ace Rodstin on 11/20/23. // // Copyright (C) 2023 Ace Rodstin. All rights reserved. // #include "Tests/ArgumentsParserTests.h" using namespace tests; ArgumentsParserTests::ArgumentsParserTests(): TestSuit("ArgumentsParserTests", { TestCase("parseEmptyList", [&]() { // Given int argc = 1; char arg1[] = "${PROJECT_DIRECTORY}"; char* argv[] { arg1 }; // When ArgumentsParser argumentsParser {}; auto arguments = argumentsParser.parse(argc, argv); auto argument = arguments.next(); // Then assertFalse(arguments.hasMore()); }), TestCase("parseArguments", [&]() { // Given int argc = 3; char arg1[] = "${PROJECT_DIRECTORY}"; char arg2[] = "--include-directory"; char arg3[] = "include"; char* argv[] { arg1, arg2, arg3 }; string expected1 = "--include-directory"; string expected2 = "include"; // When ArgumentsParser argumentsParser {}; auto arguments = argumentsParser.parse(argc, argv); auto argument = arguments.next(); auto result1 = arguments.next(); auto result2 = arguments.next(); // Then assertEqual(result1, expected1); assertEqual(result2, expected2); }), }) {}