Github User Fetcher
1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
c/benchmarks/bench_user.cpp
Go to the documentation of this file.
1
// First benchmark, maybe add CMock for mocking fetch_github_user for the
2
// webserver
3
#include "
../src/user.h
"
4
#include <benchmark/benchmark.h>
5
6
User
fake_octo_user
= {.
login
=
"octocat"
,
7
.name =
"The Octocat"
,
8
.company =
"GitHub"
,
9
.location =
"San Francisco"
};
10
11
// cppcheck-suppress constParameterCallback
12
static
void
BM_PrintUser
(benchmark::State &state) {
13
for
(
auto
_
: state) {
14
print_github_user
(&
fake_octo_user
);
15
}
16
}
17
18
// Cast the function pointer to the expected signature
19
BENCHMARK
(
BM_PrintUser
);
20
21
BENCHMARK_MAIN
();
BENCHMARK_MAIN
BENCHMARK_MAIN()
BM_PrintUser
static void BM_PrintUser(benchmark::State &state)
Definition
c/benchmarks/bench_user.cpp:12
fake_octo_user
User fake_octo_user
Definition
c/benchmarks/bench_user.cpp:6
BENCHMARK
BENCHMARK(BM_PrintUser)
_
#define _(String)
Definition
gi18n-lib.h:32
User
Structure representing a GitHub user.
Definition
user.h:9
User::login
const char * login
GitHub username.
Definition
user.h:10
print_github_user
void print_github_user(const User *user)
Print a User's information to the console.
Definition
user.c:230
user.h
benchmarks
bench_user.cpp
Generated by
1.10.0