OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_streq.cpp
Go to the documentation of this file.
1#include "test_common.hpp"
2#include <iostream>
3
6
8
9using namespace openvpn;
10
11void test(const std::string &s1, const std::string &s2, const bool should_eq)
12{
13 const bool neq = crypto::str_neq(s1, s2);
14 // OPENVPN_LOG("'" << s1 << "' cmp '" << s2 << "' " << (neq ? "NEQ" : "EQ"));
15 ASSERT_NE(neq, should_eq);
16}
17
18TEST(misc, streq)
19{
20 test("", "", true);
21 test("x", "", false);
22 test("", "x", false);
23 test("foo", "foo", true);
24 test("foobar", "foo", false);
25 test("foo", "foobar", false);
26}
27
29{
30 size_t count = 0;
31 for (size_t i = 0; i < 1000000000; ++i)
32 count += crypto::str_neq("foobarxxx", "foobar");
33 OPENVPN_LOG(count);
34}
#define OPENVPN_LOG(args)
bool str_neq(const char *s1, const char *s2)
Definition strneq.hpp:25
void test()
Definition test_rc.cpp:80
TEST(misc, streq)
void test_timing()