-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathQuery.cpp
More file actions
42 lines (33 loc) · 1.24 KB
/
Query.cpp
File metadata and controls
42 lines (33 loc) · 1.24 KB
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
40
41
42
#include <iostream>
#include <cassert>
#include "../src/QueryParser.h"
int main() {
{
std::string buf = "?test1=&test2=someValue";
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "someValue");
}
{
std::string buf = "?test1=&test2=someValue";
assert(uWS::getDecodedQueryValue("test1", (char *) buf.data()) == "");
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "someValue");
}
{
std::string buf = "?Kest1=&test2=someValue";
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "someValue");
}
{
std::string buf = "?Test1=&Kest2=some";
assert(uWS::getDecodedQueryValue("Test1", (char *) buf.data()) == "");
assert(uWS::getDecodedQueryValue("Kest2", (char *) buf.data()) == "some");
}
{
std::string buf = "?Test1=&Kest2=some";
assert(uWS::getDecodedQueryValue("Test1", (char *) buf.data()).data() != nullptr);
assert(uWS::getDecodedQueryValue("sdfsdf", (char *) buf.data()).data() == nullptr);
}
{
std::string buf = "?Kest1=&test2=some%20Value";
assert(uWS::getDecodedQueryValue("test2", (char *) buf.data()) == "some Value");
}
return 0;
}