mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
🧰 Adding clang-tidy, cmake-format, and ASAN tests (#168)
* adding clang-tidy and asan tests Playing with clang-tidy, we already had the rule removed in #166... running the static analyzer from CMake reproduced the report in many places... I suspect the macro and `new`/`delete` separation clang-tidy is just unable to understand. Running the problematic examples + tests with the ASAN enabled reported no problems * Apply suggestions from code review * Update lint.yml * applying linting rules * fix bad rename * formating * clang-tidy on jsoncons tests * and cmake-format to lint * cmake format improve change detection * Update lint.yml * apply linting
This commit is contained in:
@@ -14,7 +14,7 @@ std::string make_pico_token() {
|
||||
|
||||
jwt::claim::set_t list{"once", "twice"};
|
||||
|
||||
std::vector<int64_t> big_numbers{727663072ull, 770979831ull, 427239169ull, 525936436ull};
|
||||
std::vector<int64_t> big_numbers{727663072ULL, 770979831ULL, 427239169ULL, 525936436ULL};
|
||||
|
||||
const auto time = jwt::date::clock::now();
|
||||
|
||||
@@ -48,22 +48,15 @@ std::string make_nlohmann_token() {
|
||||
static jwt::json::type get_type(const json& val) {
|
||||
using jwt::json::type;
|
||||
|
||||
if (val.type() == json::value_t::boolean)
|
||||
return type::boolean;
|
||||
else if (val.type() == json::value_t::number_integer)
|
||||
return type::integer;
|
||||
else if (val.type() == json::value_t::number_unsigned) // nlohmann internally tracks two types of integers
|
||||
return type::integer;
|
||||
else if (val.type() == json::value_t::number_float)
|
||||
return type::number;
|
||||
else if (val.type() == json::value_t::string)
|
||||
return type::string;
|
||||
else if (val.type() == json::value_t::array)
|
||||
return type::array;
|
||||
else if (val.type() == json::value_t::object)
|
||||
return type::object;
|
||||
else
|
||||
throw std::logic_error("invalid type");
|
||||
if (val.type() == json::value_t::boolean) return type::boolean;
|
||||
if (val.type() == json::value_t::number_integer) return type::integer;
|
||||
// nlohmann internally tracks two types of integers
|
||||
if (val.type() == json::value_t::number_unsigned) return type::integer;
|
||||
if (val.type() == json::value_t::number_float) return type::number;
|
||||
if (val.type() == json::value_t::string) return type::string;
|
||||
if (val.type() == json::value_t::array) return type::array;
|
||||
if (val.type() == json::value_t::object) return type::object;
|
||||
throw std::logic_error("invalid type");
|
||||
}
|
||||
|
||||
static json::object_t as_object(const json& val) {
|
||||
@@ -115,7 +108,7 @@ std::string make_nlohmann_token() {
|
||||
|
||||
claim::set_t list{"once", "twice"};
|
||||
|
||||
std::vector<int64_t> big_numbers{727663072ull, 770979831ull, 427239169ull, 525936436ull};
|
||||
std::vector<int64_t> big_numbers{727663072ULL, 770979831ULL, 427239169ULL, 525936436ULL};
|
||||
|
||||
const auto time = jwt::date::clock::now();
|
||||
|
||||
@@ -135,7 +128,7 @@ std::string make_nlohmann_token() {
|
||||
.sign(jwt::algorithm::none{});
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv) {
|
||||
int main() {
|
||||
const auto token = make_pico_token();
|
||||
auto decoded = jwt::decode(token);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user