Skip to content

Commit

Permalink
Added perf test
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kürzeder committed Jul 23, 2019
1 parent 4cf2219 commit ca6decf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ int main(int argc, char* argv[])
{
const auto decoded_jwt = jwt::decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.XbPfbIHMI6arZ3Y922BhjWgQzWXcXNrz0ogtVhfEd2o");

auto begin = std::chrono::high_resolution_clock::now();
std::cout << "Testing JWT verify, wrong secret" << std::endl;
try
{
Expand All @@ -20,7 +21,10 @@ int main(int argc, char* argv[])
{
std::cout << "\tException caught: " << e.what() << std::endl;
}
auto time = (std::chrono::high_resolution_clock::now() - begin) / std::chrono::milliseconds(1);
std::cout << "Took: " << time << "ms." << std::endl;

begin = std::chrono::high_resolution_clock::now();
std::cout << "Testing JWT verify, correct secret" << std::endl;
try
{
Expand All @@ -34,7 +38,10 @@ int main(int argc, char* argv[])
{
std::cout << "\tException caught: " << e.what() << std::endl;
}
time = (std::chrono::high_resolution_clock::now() - begin) / std::chrono::milliseconds(1);
std::cout << "Took: " << time << "ms." << std::endl;

begin = std::chrono::high_resolution_clock::now();
std::cout << "Reading JWT claims" << std::endl;
try
{
Expand All @@ -47,6 +54,8 @@ int main(int argc, char* argv[])
{
std::cout << "\tException caught: " << e.what() << std::endl;
}
time = (std::chrono::high_resolution_clock::now() - begin) / std::chrono::milliseconds(1);
std::cout << "Took: " << time << "ms." << std::endl;

std::cin.get();
return 0;
Expand Down

0 comments on commit ca6decf

Please sign in to comment.