ROOT
ROOT project
Loading...
Searching...
No Matches
reader_base_tester.hpp
Go to the documentation of this file.
1#ifndef READER_BASE_TESTER_HPP
2#define READER_BASE_TESTER_HPP
3
4#include <gtest/gtest.h>
5
6#include "ROOT/reader.hpp"
7
12class ReaderBaseTester : public ::testing::Test {
13 public:
20 void testTrim(const std::string& input, const std::string& expected) {
21 EXPECT_EQ(ReaderBase::trim(input), expected);
22 }
23
30 void testParseBool(const std::string& input, const bool& expected) {
31 bool value;
32 EXPECT_TRUE(ReaderBase::parseBool(input, value));
33 EXPECT_EQ(value, expected);
34 }
35
42 void testParseDouble(const std::string& input, const double& expected) {
43 double value;
44 EXPECT_TRUE(ReaderBase::parseDouble(input, value));
45 EXPECT_DOUBLE_EQ(value, expected);
46 }
47
54 void testParseInt(const std::string& input, const int& expected) {
55 int value;
56 EXPECT_TRUE(ReaderBase::parseInt(input, value));
57 EXPECT_EQ(value, expected);
58 }
59
66 void testParseMethod(const std::string& input, const Method& expected) {
67 Method method;
68 EXPECT_TRUE(ReaderBase::parseMethod(input, method));
69 EXPECT_EQ(method, expected);
70 }
71};
72
73#endif // READER_BASE_TESTER_HPP
Test fixture class for ReaderBase unit tests.
Definition reader_base_tester.hpp:12
void testParseMethod(const std::string &input, const Method &expected)
Test the parseMethod method of ReaderBase.
Definition reader_base_tester.hpp:66
void testParseBool(const std::string &input, const bool &expected)
Test the parseBool method of ReaderBase.
Definition reader_base_tester.hpp:30
void testParseDouble(const std::string &input, const double &expected)
Test the parseDouble method of ReaderBase.
Definition reader_base_tester.hpp:42
void testParseInt(const std::string &input, const int &expected)
Test the parseInt method of ReaderBase.
Definition reader_base_tester.hpp:54
void testTrim(const std::string &input, const std::string &expected)
Test the trim method of ReaderBase.
Definition reader_base_tester.hpp:20
static bool parseBool(const std::string &bool_str, bool &out)
Helper static method to parse a boolean value from a string.
Definition reader.cpp:26
static bool parseInt(const std::string &int_str, int &out)
Helper static method to parse an integer value from a string.
Definition reader.cpp:51
static std::string trim(const std::string &untrimmed_str)
Helper static method to trim leading and trailing whitespace from a string.
Definition reader.cpp:14
static bool parseMethod(const std::string &method_str, Method &out)
Helper static method to parse a Method enum value from a string.
Definition reader.cpp:61
static bool parseDouble(const std::string &double_str, double &out)
Helper static method to parse a double value from a string.
Definition reader.cpp:41
Method
Enumeration of available root-finding methods.
Definition method.hpp:8
Reader classes for reading configuration from files.