text
stringlengths
1
24.5M
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <stddef.h> // size_t #include <string.h> // strcmp #include <ArduinoJson/Polyfills/assert.hpp> #include <ArduinoJson/Polyfills/attributes.hpp> #include <ArduinoJson/Strings/StringAdapter.hpp> A...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Strings/Adapters/RamString.hpp> #include <ArduinoJson/Strings/StringAdapter.hpp> #include <ArduinoJson/Strings/StringTraits.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <typenam...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Namespace.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE template <typename T, typename Enable = void> struct Converter; ARDUINOJSON_END_PUBLIC_NAMESPACE ARDUINOJSON_BEGIN_PRIVATE_NAMESPA...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Json/JsonSerializer.hpp> #include <ArduinoJson/Memory/StringBuilder.hpp> #include <ArduinoJson/Polyfills/utility.hpp> #include <ArduinoJson/Variant/JsonVariantConst.hpp> #if ARDUINOJS...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/VariantRefBase.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE // A reference to a value in a JsonDocument. // https://arduinojson.org/v7/api/jsonvariant/ class JsonVariant : public ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <stddef.h> #include <stdint.h> // for uint8_t #include <ArduinoJson/Memory/ResourceManager.hpp> #include <ArduinoJson/Polyfills/type_traits.hpp> #include <ArduinoJson/Strings/IsString.hpp> #inclu...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/JsonVariant.hpp> #include <ArduinoJson/Variant/JsonVariantVisitor.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE class JsonVariantCopier { public: using result_type = bool; J...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Array/JsonArray.hpp> #include <ArduinoJson/Object/JsonObject.hpp> #include <ArduinoJson/Variant/JsonVariant.hpp> #include <ArduinoJson/Variant/VariantDataVisitor.hpp> ARDUINOJSON_BEGI...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Polyfills/attributes.hpp> #include <ArduinoJson/Polyfills/type_traits.hpp> #include <ArduinoJson/Variant/VariantImpl.hpp> #include "JsonVariantConst.hpp" ARDUINOJSON_BEGIN_PRIVATE_NAM...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Configuration.hpp> #include <ArduinoJson/Numbers/arithmeticCompare.hpp> #include <ArduinoJson/Polyfills/type_traits.hpp> #include <ArduinoJson/Polyfills/utility.hpp> #include <ArduinoJ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <stddef.h> // size_t #include <ArduinoJson/Numbers/JsonFloat.hpp> #include <ArduinoJson/Numbers/JsonInteger.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE enum class VariantTypeBits : uint8_t { Own...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Memory/StringNode.hpp> #include <ArduinoJson/Strings/JsonString.hpp> #include <ArduinoJson/Variant/VariantContent.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <typename T> T par...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Numbers/JsonFloat.hpp> #include <ArduinoJson/Numbers/JsonInteger.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <typename TResult> struct VariantDataVisitor { using result_type ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Collection/CollectionIterator.hpp> #include <ArduinoJson/Memory/ResourceManager.hpp> #include <ArduinoJson/Misc/SerializedValue.hpp> #include <ArduinoJson/Numbers/convertNumber.hpp> #i...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Numbers/arithmeticCompare.hpp> #include <ArduinoJson/Polyfills/attributes.hpp> #include <ArduinoJson/Polyfills/type_traits.hpp> #include <ArduinoJson/Variant/VariantTag.hpp> ARDUINOJS...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Configuration.hpp> #include <ArduinoJson/Variant/Converter.hpp> #include <ArduinoJson/Variant/JsonVariantConst.hpp> #include <ArduinoJson/Variant/VariantOperators.hpp> ARDUINOJSON_BEG...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Array/JsonArray.hpp> #include <ArduinoJson/Object/JsonObject.hpp> #include <ArduinoJson/Variant/VariantRefBase.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <typename TDerived> i...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Namespace.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE struct VariantTag {}; template <typename T> struct IsVariant : is_base_of<VariantTag, T> {}; ARDUINOJSON_END_PRIVATE_NAMESPACE
/* StaticThreadController.h - Controlls a list of Threads with different timings Basicaly, what it does is to keep track of current Threads and run when necessary. StaticThreadController is an extended class of Thread, because of that, it allows you to add a StaticThreadController inside another kind of ThreadCo...
#include "Thread.h" Thread::Thread(void (*callback)(void), unsigned long _interval){ enabled = true; onRun(callback); _cached_next_run = 0; last_run = millis(); ThreadID = (int)this; #ifdef USE_THREAD_NAMES ThreadName = "Thread "; ThreadName = ThreadName + ThreadID; #endif setInterval(_interval); }; voi...
/* Thread.h - An runnable object Thread is responsable for holding the "action" for something, also, it responds if it "should" or "should not" run, based on the current time; For instructions, go to https://github.com/ivanseidel/ArduinoThread Created by Ivan Seidel Gomes, March, 2013. Released into the publ...
#include "Thread.h" #include "ThreadController.h" ThreadController::ThreadController(unsigned long _interval): Thread(){ cached_size = 0; clear(); setInterval(_interval); #ifdef USE_THREAD_NAMES // Overrides name ThreadName = "ThreadController "; ThreadName = ThreadName + ThreadID; #endif } /* ThreadCon...
/* ThreadController.h - Controlls a list of Threads with different timings Basicaly, what it does is to keep track of current Threads and run when necessary. ThreadController is an extended class of Thread, because of that, it allows you to add a ThreadController inside another ThreadController... For instruc...
/*! \mainpage Arduino MIDI Library See the documentation of the main class, MidiInterface, or browse the modules and examples using the sidebar on the left. \n The latest development version is available on GitHub: https://github.com/FortySevenEffects/arduino_midi_library/tree/dev */ // -----------------------...
/*! * \file utility.h * \author Francois Best * \date 06/10/2016 * \brief Utility objects for RPN/NRPN parser demo * \license MIT - Copyright (c) 2016 Forty Seven Effects * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associat...
/*! * \file synth-core_NoteList.h * \author Francois Best * \date 24/05/2013 * \license GPL v3.0 - Copyright Forty Seven Effects 2013 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Fr...
/*! * \file noteList.h * \author Francois Best * \date 24/05/2013 * \brief Linked list of notes, for Low, Last & High playing modes. * \license GPL v3.0 - Copyright Forty Seven Effects 2013 * * This program is free software: you can redistribute it and/or modify * it under the ter...
/************************************************* * Public Constants *************************************************/ #include <inttypes.h> #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G...
/*! * @file MIDI.cpp * Project Arduino MIDI Library * @brief MIDI Library for the Arduino * @author Francois Best * @date 24/02/11 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this softw...
/*! * @file MIDI.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino * @author Francois Best, lathoub * @date 24/02/11 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person obtaining a copy * of thi...
/*! * @file MIDI.hpp * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Inline implementations * @author Francois Best, lathoub * @date 24/02/11 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person...
/*! * @file midi_Defs.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Definitions * @author Francois Best, lathoub * @date 24/02/11 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person obtaini...
/*! * @file midi_Message.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Message struct definition * @author Francois Best * @date 11/06/14 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person...
/*! * @file midi_Namespace.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Namespace declaration * @author Francois Best * @date 24/02/11 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person o...
/*! * @file midi_Platform.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Platform * @license MIT - Copyright (c) 2015 Francois Best * @author lathoub * @date 22/03/20 * * Permission is hereby granted, free of charge, to any person obtaining a copy * o...
/*! * @file midi_Settings.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Settings * @author Francois Best * @date 24/02/11 * @license MIT - Copyright (c) 2015 Francois Best * * Permission is hereby granted, free of charge, to any person obtaining a cop...
/*! * @file serialMIDI.h * Project Arduino MIDI Library * @brief MIDI Library for the Arduino - Platform * @license MIT - Copyright (c) 2015 Francois Best * @author lathoub, Francois Best * @date 22/03/20 * * Permission is hereby granted, free of charge, to any person obtaining...
#include "test-mocks.h" BEGIN_TEST_MOCKS_NAMESPACE END_TEST_MOCKS_NAMESPACE
#pragma once #include "test-mocks_Namespace.h" BEGIN_TEST_MOCKS_NAMESPACE END_TEST_MOCKS_NAMESPACE
#pragma once #define TEST_MOCKS_NAMESPACE test_mocks #define BEGIN_TEST_MOCKS_NAMESPACE namespace TEST_MOCKS_NAMESPACE { #define END_TEST_MOCKS_NAMESPACE } #define USING_NAMESPACE_TEST_MOCKS using namespace TEST_MOCKS_NAMESPACE; BEGIN_TEST_MOCKS_NAMESPACE END_TEST_MOCKS_NAMESPACE
#include "test-mocks_SerialMock.h" BEGIN_TEST_MOCKS_NAMESPACE END_TEST_MOCKS_NAMESPACE
#pragma once #include "test-mocks.h" #include <inttypes.h> BEGIN_TEST_MOCKS_NAMESPACE template<typename DataType, int Size> class RingBuffer { public: RingBuffer(); ~RingBuffer(); public: int getLength() const; bool isEmpty() const; public: void write(DataType inData); void write(const Dat...
#pragma once BEGIN_TEST_MOCKS_NAMESPACE template<typename DataType, int Size> RingBuffer<DataType, Size>::RingBuffer() : mWriteHead(mData) , mReadHead(mData) { memset(mData, DataType(0), Size * sizeof(DataType)); } template<typename DataType, int Size> RingBuffer<DataType, Size>::~RingBuffer() { } // --...
#include "unit-tests.h" int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
#pragma once #include "unit-tests_Namespace.h" #include <gtest/gtest.h> #include <gmock/gmock.h> BEGIN_UNIT_TESTS_NAMESPACE END_UNIT_TESTS_NAMESPACE
#pragma once #define UNIT_TESTS_NAMESPACE unit_tests #define BEGIN_UNIT_TESTS_NAMESPACE namespace UNIT_TESTS_NAMESPACE { #define END_UNIT_TESTS_NAMESPACE } #define BEGIN_UNNAMED_NAMESPACE namespace { #define END_UNNAMED_NAMESPACE } #define USING_NAMESPACE_U...
#include "unit-tests.h" #include "unit-tests_Settings.h" #include <src/MIDI.h> #include <test/mocks/test-mocks_SerialMock.h> BEGIN_MIDI_NAMESPACE END_MIDI_NAMESPACE // ----------------------------------------------------------------------------- BEGIN_UNNAMED_NAMESPACE using namespace testing; USING_NAMESPACE_UNIT...
#include "unit-tests.h" #include "unit-tests_Settings.h" #include <src/MIDI.h> #include <test/mocks/test-mocks_SerialMock.h> BEGIN_MIDI_NAMESPACE END_MIDI_NAMESPACE // ----------------------------------------------------------------------------- BEGIN_UNNAMED_NAMESPACE using namespace testing; USING_NAMESPACE_UNIT...
#include "unit-tests.h" #include <src/midi_Message.h> BEGIN_MIDI_NAMESPACE // Declare references: // http://stackoverflow.com/questions/4891067/weird-undefined-symbols-of-static-constants-inside-a-struct-class template<unsigned Size> const unsigned Message<Size>::sSysExMaxSize; END_MIDI_NAMESPACE // --------------...
#include "unit-tests.h" #include "unit-tests_Settings.h" #include <src/MIDI.h> #include <test/mocks/test-mocks_SerialMock.h> BEGIN_MIDI_NAMESPACE END_MIDI_NAMESPACE // ----------------------------------------------------------------------------- BEGIN_UNNAMED_NAMESPACE using namespace testing; USING_NAMESPACE_UNIT...
#include "unit-tests.h" #include "unit-tests_Settings.h" #include <src/MIDI.h> #include <test/mocks/test-mocks_SerialMock.h> BEGIN_MIDI_NAMESPACE END_MIDI_NAMESPACE // ----------------------------------------------------------------------------- BEGIN_UNNAMED_NAMESPACE using namespace testing; USING_NAMESPACE_UNIT...
#include "unit-tests_Settings.h" BEGIN_MIDI_NAMESPACE const bool DefaultSettings::UseRunningStatus; const bool DefaultSettings::HandleNullVelocityNoteOnAsNoteOff; const bool DefaultSettings::Use1ByteParsing; const unsigned DefaultSettings::SysExMaxSize; END_MIDI_NAMESPACE // ----------------------------------------...
#pragma once #include "unit-tests.h" #include <src/midi_Settings.h> BEGIN_UNIT_TESTS_NAMESPACE template<bool RunningStatus, bool OneByteParsing> struct VariableSettings : public midi::DefaultSettings { static const bool UseRunningStatus = RunningStatus; static const bool Use1ByteParsing = OneByteParsing; };...
#include "unit-tests.h" #include <src/MIDI.h> BEGIN_MIDI_NAMESPACE END_MIDI_NAMESPACE // ----------------------------------------------------------------------------- BEGIN_UNNAMED_NAMESPACE using namespace testing; TEST(SysExCodec, EncoderAscii) { const byte input[] = "Hello, World!"; byte buffer[16]; ...
/* __ _ _ __ __ _ _ __ __ _ _ __ ___ ___ / _` | '__/ _` | '_ \ / _` | '__/ __|/ _ \ Argument Parser for Modern C++ | (_| | | | (_| | |_) | (_| | | \__ \ __/ http://github.com/p-ranav/argparse \__,_|_| \__, | .__/ \__,_|_| |___/\___| |___/|_| Licensed under the MIT License <http://opensource.org/l...
/* __ _ _ __ __ _ _ __ __ _ _ __ ___ ___ / _` | '__/ _` | '_ \ / _` | '__/ __|/ _ \ Argument Parser for Modern C++ | (_| | | | (_| | |_) | (_| | | \__ \ __/ http://github.com/p-ranav/argparse \__,_|_| \__, | .__/ \__,_|_| |___/\___| |___/|_| Licensed under the MIT License <http://opensource.org/l...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("-a").flag(); program.add_argument("-b").flag(); program.add_argument("-c") .nargs(2) .default_value(std::vector<float>{0.0f, 0.0f})...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> #include <cassert> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.set_prefix_chars("-+/"); program.set_assign_chars("=:"); program.add_argument("--foo"); program.add_argument("/B"); try { program.p...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> #include <cassert> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.set_prefix_chars("-+/"); program.add_argument("+f"); program.add_argument("--bar"); program.add_argument("/foo"); try { program.par...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("main"); program.add_argument("thing").help("Thing to use.").metavar("THING"); program.add_argument("--member") .help("The alias for the member to pass to.") .metavar(...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("compiler"); program.add_argument("files").remaining(); try { program.parse_args(argc, argv); } catch (const std::exception &err) { std::cerr << err.what() << std::end...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("--color") .default_value(std::string{ "orange"}) // might otherwise be type const char* leading to an error // w...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("--color") .default_value<std::vector<std::string>>({"orange"}) .append() .help("specify the cat's fur color"); try { program...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("main"); program.add_argument("--input_files") .help("The list of input files") .nargs(2); try { program.parse_args( argc, argv); // Example: ./main --i...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("integer").help("Input number").scan<'i', int>(); program.add_argument("floats") .help("Vector of floats") .nargs(4) .scan<'g', f...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("--verbose") .help("increase output verbosity") .default_value(false) .implicit_value(true); try { program.parse_args(argc, a...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> #include <cassert> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("--foo").implicit_value(true).default_value(false); program.add_argument("bar"); auto unknown_args = program.parse_known_args(a...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("main"); program.add_argument("square") .help("display the square of a given number") .scan<'i', int>(); program.add_argument("--verbose").flag(); try { progr...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); int verbosity = 0; program.add_argument("-V", "--verbose") .action([&](const auto &) { ++verbosity; }) .append() .default_value(false) .implicit_...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("test"); program.add_argument("-o", "--output") .required() .help("specify the output file."); try { program.parse_args(argc, argv); } catch (const std::except...
// SPDX-License-Identifier: MIT #include <argparse/argparse.hpp> int main(int argc, char *argv[]) { argparse::ArgumentParser program("git"); // git add subparser argparse::ArgumentParser add_command("add"); add_command.add_description("Add file contents to the index"); add_command.add_argument("files") ...
module; #include <argparse/argparse.hpp> export module argparse.details; export namespace argparse::details { using argparse::details::repr; }
// ====================================================================== lgtm [cpp/missing-header-guard] // == DO NOT MODIFY THIS FILE BY HAND - IT IS AUTO GENERATED BY CMAKE! == // ====================================================================== // // doctest.h - the lightest feature-rich C++ single-header test...
#include <doctest.hpp>
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Users can use default value inside actions" * test_suite("actions")) { argparse::ArgumentParser program("test"); program.add_argument("input").default_value("bar...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <string> #include <vector> using doctest::test_suite; TEST_CASE("Simplest .append" * test_suite("append")) { argparse::ArgumentParser program("test"); program.add_argument("--dir").append(); progra...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Get argument with .at()" * test_suite("as_container")) { argparse::ArgumentParser program("test"); auto &dir_arg = program.add_argument("--dir"); program.at("--dir").def...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("ArgumentParser in bool context" * test_suite("argument_parser")) { argparse::ArgumentParser program("test"); program.add_argument("cases").remaining(); program.parse_a...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Parse argument that is provided zero choices" * test_suite("choices")) { argparse::ArgumentParser program("test"); REQUIRE_THROWS_WITH_AS(program.add_argument("...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <test_utility.hpp> using doctest::test_suite; TEST_CASE("Parse compound toggle arguments with implicit values" * test_suite("compound_arguments")) { argparse::ArgumentParser program("test"); ...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <test_utility.hpp> using doctest::test_suite; TEST_CASE("Parse vector of arguments" * test_suite("vector")) { argparse::ArgumentParser program("test"); program.add_argument("input").nargs(2); progr...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <iostream> #include <sstream> #include <streambuf> using doctest::test_suite; TEST_CASE("Include all default arguments" * test_suite("default_args")) { argparse::ArgumentParser parser("test"); auto h...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <string> using doctest::test_suite; TEST_CASE("Use a 'string' default value" * test_suite("default_value")) { argparse::ArgumentParser program("test"); SUBCASE("Use a const char[] default value") { ...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <iostream> #include <string> #include <vector> using doctest::test_suite; TEST_CASE("Basic --value=value" * test_suite("equals_form")) { argparse::ArgumentParser parser("test"); parser.add_argument("...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <iostream> #include <string> #include <vector> using doctest::test_suite; TEST_CASE("Missing optional argument name" * test_suite("error_reporting")) { argparse::ArgumentParser parser("test"); parser...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <any> using doctest::test_suite; TEST_CASE("Getting a simple argument" * test_suite("ArgumentParser::get")) { argparse::ArgumentParser program("test"); program.add_argument("-s", "--stuff"); REQUIR...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <optional> #include <sstream> using doctest::test_suite; TEST_CASE("Users can format help message" * test_suite("help")) { argparse::ArgumentParser program("test"); SUBCASE("Simple arguments") { ...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Test setting a hidden alias for an argument" * test_suite("hidden_alias")) { argparse::ArgumentParser program("test"); auto &arg = program.add_argument("--suppre...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Test setting a hidden argument" * test_suite("hidden_argument")) { argparse::ArgumentParser program("program"); program.add_argument("--hidden").flag().hidden(); program...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Parse unknown optional argument" * test_suite("compound_arguments")) { argparse::ArgumentParser bfm("bfm"); bfm.add_argument("-l", "--load").help("load a VMM i...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Issues with implicit values #37" * test_suite("implicit_values")) { argparse::ArgumentParser m_bfm("test"); m_bfm.add_argument("-l", "--load").help("load a VMM into the ke...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("User-supplied argument" * test_suite("is_used")) { argparse::ArgumentParser program("test"); program.add_argument("--dir").default_value(std::string("/")); program.parse...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Create mutually exclusive group with 2 arguments" * test_suite("mutex_args")) { argparse::ArgumentParser program("test"); auto &group = program.add_mutually_exc...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Parse negative integer" * test_suite("positional_arguments")) { argparse::ArgumentParser program; program.add_argument("--verbose", "-v") .help("enable verbose loggi...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Parse toggle arguments with default value" * test_suite("optional_arguments")) { argparse::ArgumentParser program("test"); program.add_argument("--verbose", "-v"...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Add parent parsers" * test_suite("parent_parsers")) { argparse::ArgumentParser parent_parser("main"); parent_parser.add_argument("--verbose") .default_value(false) ...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <optional> using doctest::test_suite; TEST_CASE("Missing argument" * test_suite("parse_args")) { argparse::ArgumentParser program("test"); program.add_argument("--config").nargs(1); REQUIRE_THROWS_...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <doctest.hpp> #include <string> #include <vector> using doctest::test_suite; TEST_CASE("Parse unknown optional and positional arguments without exceptions" * test_suite("parse_known_args")) { argparse::ArgumentPars...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <cmath> #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Parse positional arguments" * test_suite("positional_arguments")) { argparse::ArgumentParser program("test"); program.add_argument("input"); program.add...
#ifdef WITH_MODULE import argparse; #else #include <argparse/argparse.hpp> #endif #include <cmath> #include <doctest.hpp> using doctest::test_suite; TEST_CASE("Parse with custom prefix chars" * test_suite("prefix_chars")) { argparse::ArgumentParser program("test"); program.set_prefix_chars("-+"); program.add_ar...