Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
nawaz1991 committed Jul 9, 2024
1 parent c782412 commit 32878cf
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 88 deletions.
6 changes: 3 additions & 3 deletions src/oas_validator_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// [ END OF LICENSE 7982e23aed1dc8eda1fdc979fee617354ae998dc ]

#include "oas_validator_imp.hpp"
#include <rapidjson/istreamwrapper.h>
#include <fstream>
#include <rapidjson/istreamwrapper.h>

OASValidatorImp::OASValidatorImp(const std::string& oas_specs)
{
Expand All @@ -23,8 +23,8 @@ OASValidatorImp::OASValidatorImp(const std::string& oas_specs)
}

if (doc.HasParseError()) {
throw ValidatorInitExc("Unable to parse specs: " + oas_specs + " \nError code: " + std::to_string(doc.GetParseError()) + " at offset: " +
std::to_string(doc.GetErrorOffset()) + " Error message: " + rapidjson::GetParseError_En(doc.GetParseError()));
throw ValidatorInitExc("Unable to parse specs: " + oas_specs + " \nError code: " + std::to_string(doc.GetParseError()) +
" at offset: " + std::to_string(doc.GetErrorOffset()) + " Error message: " + rapidjson::GetParseError_En(doc.GetParseError()));
}

const rapidjson::Value& paths = doc["paths"];
Expand Down
16 changes: 8 additions & 8 deletions test/perftest/src/perftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class OASValidatorPerf: public ::benchmark::Fixture
SetDefaultTimeUnit(::benchmark::kMicrosecond);
MinWarmUpTime(K_MIN_WARM_UP_TIME);
MinTime(K_MIN_TIME);
}
}

void TearDown(benchmark::State&) override
{
validator.reset();
}
validator.reset();
}

std::unique_ptr<OASValidator> validator;
};
Expand Down Expand Up @@ -138,7 +138,7 @@ BENCHMARK_F(OASValidatorPerf, ValidRequest)(benchmark::State& state)
}
}

BENCHMARK_F(OASValidatorPerf, InvalidRequest1)(benchmark::State& state) // Check 1: Invalid method
BENCHMARK_F(OASValidatorPerf, InvalidRequest1)(benchmark::State& state) // Check 1: Invalid method
{
std::string err_msg;
std::unordered_map<std::string, std::string> headers;
Expand All @@ -149,7 +149,7 @@ BENCHMARK_F(OASValidatorPerf, InvalidRequest1)(benchmark::State& state) // Chec
}
}

BENCHMARK_F(OASValidatorPerf, InvalidRequest2)(benchmark::State& state)// Check 2: Invalid Path
BENCHMARK_F(OASValidatorPerf, InvalidRequest2)(benchmark::State& state) // Check 2: Invalid Path
{
std::string err_msg;
std::unordered_map<std::string, std::string> headers;
Expand All @@ -159,7 +159,7 @@ BENCHMARK_F(OASValidatorPerf, InvalidRequest2)(benchmark::State& state)// Check
err_msg);
}
}
BENCHMARK_F(OASValidatorPerf, InvalidRequest3)(benchmark::State& state) // Check 3: Invalid Path param
BENCHMARK_F(OASValidatorPerf, InvalidRequest3)(benchmark::State& state) // Check 3: Invalid Path param
{
std::string err_msg;
std::unordered_map<std::string, std::string> headers;
Expand All @@ -170,7 +170,7 @@ BENCHMARK_F(OASValidatorPerf, InvalidRequest3)(benchmark::State& state) // Chec
}
}

BENCHMARK_F(OASValidatorPerf, InvalidRequest4)(benchmark::State& state)// Check 4: Invalid Query param
BENCHMARK_F(OASValidatorPerf, InvalidRequest4)(benchmark::State& state) // Check 4: Invalid Query param
{
std::string err_msg;
std::unordered_map<std::string, std::string> headers;
Expand All @@ -181,7 +181,7 @@ BENCHMARK_F(OASValidatorPerf, InvalidRequest4)(benchmark::State& state)// Check
}
}

BENCHMARK_F(OASValidatorPerf, InvalidRequest5)(benchmark::State& state)// Check 5: Invalid Header param
BENCHMARK_F(OASValidatorPerf, InvalidRequest5)(benchmark::State& state) // Check 5: Invalid Header param
{
std::string err_msg;
std::unordered_map<std::string, std::string> headers;
Expand Down
32 changes: 16 additions & 16 deletions test/unittest/src/deserializers/object_deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ TEST_P(ObjectDeserializerTest, Deserialize)
}

INSTANTIATE_TEST_SUITE_P(ObjectDeserializerTests, ObjectDeserializerTest,
::testing::Values(std::make_tuple("boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", '\0', false, ',', ',', false, false),
std::make_tuple("boolTrue=true,boolFalse=false,int=123,number=123.456,string=abc%20xyz", '\0', false, '=', ',', false, false),
std::make_tuple(".boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", '.', false, ',', ',', false, false),
std::make_tuple(".boolTrue=true,boolFalse=false,int=123,number=123.456,string=abc%20xyz", '.', false, '=', ',', false, false),
std::make_tuple(";test=boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", ';', true, ',', ',', false, false),
std::make_tuple(";boolTrue=true;boolFalse=false;int=123;number=123.456;string=abc%20xyz", ';', false, '=', ';', false, false),
std::make_tuple("?boolTrue=true&boolFalse=false&int=123&number=123.456&string=abc%20xyz", '?', false, '=', '&', false, false),
std::make_tuple("?test=boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", '?', true, ',', ',', false, false),
std::make_tuple("?test[boolTrue]=true&test[boolFalse]=false&test[int]=123&test[number]=123.456&test[string]=abc%20xyz", '?', true, '=',
'&', true, false),
std::make_tuple("boolTrue,true,boolFalse,false,int,str,number,123.456,string,abc%20xyz", '\0', false, ',', ',', false, true),
std::make_tuple("boolTrue=true,boolFalse=false,int=123,number=123.456,string=abc%2xyz", '\0', false, '=', ',', false, true),
std::make_tuple(".boolTrue,true,boolFalse,false,int,123,number,1.23.456,string,abc%20xyz", '.', false, ',', ',', false, true),
std::make_tuple(".boolTrue;true,boolFalse=false,int=123,number=123.456,string=abc%20xyz", '.', false, '=', ',', false, true),
std::make_tuple("test=boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", ';', true, ',', ',', false, true),
std::make_tuple(";boolTrue,true;boolFalse=false;int=123;number=123.456;string=abc%20xyz", ';', false, '=', ';', false, true)));
::testing::Values(std::make_tuple("boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", '\0', false, ',', ',', false, false),
std::make_tuple("boolTrue=true,boolFalse=false,int=123,number=123.456,string=abc%20xyz", '\0', false, '=', ',', false, false),
std::make_tuple(".boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", '.', false, ',', ',', false, false),
std::make_tuple(".boolTrue=true,boolFalse=false,int=123,number=123.456,string=abc%20xyz", '.', false, '=', ',', false, false),
std::make_tuple(";test=boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", ';', true, ',', ',', false, false),
std::make_tuple(";boolTrue=true;boolFalse=false;int=123;number=123.456;string=abc%20xyz", ';', false, '=', ';', false, false),
std::make_tuple("?boolTrue=true&boolFalse=false&int=123&number=123.456&string=abc%20xyz", '?', false, '=', '&', false, false),
std::make_tuple("?test=boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", '?', true, ',', ',', false, false),
std::make_tuple("?test[boolTrue]=true&test[boolFalse]=false&test[int]=123&test[number]=123.456&test[string]=abc%20xyz", '?', true, '=',
'&', true, false),
std::make_tuple("boolTrue,true,boolFalse,false,int,str,number,123.456,string,abc%20xyz", '\0', false, ',', ',', false, true),
std::make_tuple("boolTrue=true,boolFalse=false,int=123,number=123.456,string=abc%2xyz", '\0', false, '=', ',', false, true),
std::make_tuple(".boolTrue,true,boolFalse,false,int,123,number,1.23.456,string,abc%20xyz", '.', false, ',', ',', false, true),
std::make_tuple(".boolTrue;true,boolFalse=false,int=123,number=123.456,string=abc%20xyz", '.', false, '=', ',', false, true),
std::make_tuple("test=boolTrue,true,boolFalse,false,int,123,number,123.456,string,abc%20xyz", ';', true, ',', ',', false, true),
std::make_tuple(";boolTrue,true;boolFalse=false;int=123;number=123.456;string=abc%20xyz", ';', false, '=', ';', false, true)));
8 changes: 4 additions & 4 deletions test/unittest/src/validators/header_param_validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TEST_P(HeaderParamValidatorTest, ValidateParam)
}

INSTANTIATE_TEST_SUITE_P(HeaderParamValidatorTest, HeaderParamValidatorTest,
::testing::Values(std::make_tuple("123", false, "integer", ValidationError::NONE), std::make_tuple("123", true, "integer", ValidationError::NONE),
std::make_tuple("true", false, "boolean", ValidationError::NONE), std::make_tuple("true", true, "boolean", ValidationError::NONE),
std::make_tuple("123.456", false, "number", ValidationError::NONE), std::make_tuple("123.456", true, "number", ValidationError::NONE),
std::make_tuple("abc", false, "string", ValidationError::NONE), std::make_tuple("abc", true, "string", ValidationError::NONE)));
::testing::Values(std::make_tuple("123", false, "integer", ValidationError::NONE), std::make_tuple("123", true, "integer", ValidationError::NONE),
std::make_tuple("true", false, "boolean", ValidationError::NONE), std::make_tuple("true", true, "boolean", ValidationError::NONE),
std::make_tuple("123.456", false, "number", ValidationError::NONE), std::make_tuple("123.456", true, "number", ValidationError::NONE),
std::make_tuple("abc", false, "string", ValidationError::NONE), std::make_tuple("abc", true, "string", ValidationError::NONE)));
Loading

0 comments on commit 32878cf

Please sign in to comment.