forked from Psiphon-Inc/psicash-lib-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_test.cpp
More file actions
39 lines (30 loc) · 1012 Bytes
/
Copy pathutils_test.cpp
File metadata and controls
39 lines (30 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "gtest/gtest.h"
#include "utils.hpp"
using namespace std;
using namespace utils;
TEST(TestStringer, SingleValue) {
auto s = Stringer("s");
ASSERT_EQ(s, "s");
s = Stringer(123);
ASSERT_EQ(s, "123");
}
TEST(TestStringer, MultiValue) {
auto s = Stringer("one", 2, "three", 4, '5', '!');
ASSERT_EQ(s, "one2three45!");
}
TEST(TestRandomID, Simple) {
auto s = RandomID();
ASSERT_EQ(s.length(), 48);
}
TEST(TestFindHeaderValue, Simple) {
map<string, vector<string>> headers;
headers = {{"a", {"xyz"}}, {"Date", {"expected", "second"}}, {"c", {"abc", "def"}}};
auto s = FindHeaderValue(headers, "Date");
ASSERT_EQ(s, "expected");
headers = {{"date", {"expected", "second"}}, {"a", {"xyz"}}, {"c", {"abc", "def"}}};
s = FindHeaderValue(headers, "Date");
ASSERT_EQ(s, "expected");
headers = {{"a", {"xyz"}}, {"c", {"abc", "def"}}, {"DATE", {"expected", "second"}}};
s = FindHeaderValue(headers, "Date");
ASSERT_EQ(s, "expected");
}