MCPcopy Create free account
hub / github.com/apache/impala / TestUrl

Function TestUrl

be/src/util/coding-util-test.cc:33–50  ·  view source on GitHub ↗

Tests encoding/decoding of input. If expected_encoded is non-empty, the encoded string is validated against it.

Source from the content-addressed store, hash-verified

31// Tests encoding/decoding of input. If expected_encoded is non-empty, the
32// encoded string is validated against it.
33void TestUrl(const string& input, const string& expected_encoded, bool hive_compat) {
34 string intermediate;
35 UrlEncode(input, &intermediate, hive_compat);
36 string output;
37 if (!expected_encoded.empty()) {
38 EXPECT_EQ(intermediate, expected_encoded);
39 }
40 EXPECT_TRUE(UrlDecode(intermediate, &output, hive_compat));
41 EXPECT_EQ(input, output);
42
43 // Convert string to vector and try that also
44 vector<uint8_t> input_vector;
45 input_vector.resize(input.size());
46 Ubsan::MemCpy(input_vector.data(), input.c_str(), input.size());
47 string intermediate2;
48 UrlEncode(input_vector, &intermediate2, hive_compat);
49 EXPECT_EQ(intermediate, intermediate2);
50}
51
52void TestBase64(const string& input, const string& expected_encoded) {
53 string intermediate;

Callers 1

TESTFunction · 0.70

Calls 6

resizeMethod · 0.80
UrlEncodeFunction · 0.70
UrlDecodeFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected