aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_utils.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/tests/test_utils.cpp
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
Diffstat (limited to 'src/tests/test_utils.cpp')
-rw-r--r--src/tests/test_utils.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp
index 3d474d605..6edd7fd81 100644
--- a/src/tests/test_utils.cpp
+++ b/src/tests/test_utils.cpp
@@ -83,8 +83,8 @@ class Utility_Function_Tests : public Text_Based_Test
result.test_is_eq<uint8_t>(Botan::get_byte(2, in32), 0xC0);
result.test_is_eq<uint8_t>(Botan::get_byte(3, in32), 0xD0);
- result.test_is_eq<uint16_t>(Botan::make_u16bit(0xAA, 0xBB), 0xAABB);
- result.test_is_eq<uint32_t>(Botan::make_u32bit(0x01, 0x02, 0x03, 0x04), 0x01020304);
+ result.test_is_eq<uint16_t>(Botan::make_uint16(0xAA, 0xBB), 0xAABB);
+ result.test_is_eq<uint32_t>(Botan::make_uint32(0x01, 0x02, 0x03, 0x04), 0x01020304);
result.test_is_eq<uint16_t>(Botan::load_be<uint16_t>(mem, 0), 0x0011);
result.test_is_eq<uint16_t>(Botan::load_be<uint16_t>(mem, 1), 0x2233);
@@ -123,11 +123,11 @@ class Utility_Function_Tests : public Text_Based_Test
result.test_is_eq<uint64_t>(Botan::load_le<uint64_t>(mem + 7, 0), 0xEEDDCCBBAA998877);
result.test_is_eq<uint64_t>(Botan::load_le<uint64_t>(mem + 5, 0), 0xCCBBAA9988776655);
- byte outbuf[16] = { 0 };
+ uint8_t outbuf[16] = { 0 };
for(size_t offset = 0; offset != 7; ++offset)
{
- byte* out = outbuf + offset;
+ uint8_t* out = outbuf + offset;
Botan::store_be(in16, out);
result.test_is_eq<uint8_t>(out[0], 0x12);
@@ -266,7 +266,7 @@ class Base64_Tests : public Text_Based_Test
{
if(is_valid)
{
- const std::vector<byte> binary = get_req_bin(vars, "Binary");
+ const std::vector<uint8_t> binary = get_req_bin(vars, "Binary");
result.test_eq("base64 decoding", Botan::base64_decode(base64), binary);
result.test_eq("base64 encoding", Botan::base64_encode(binary), base64);
}
@@ -341,8 +341,8 @@ class Charset_Tests : public Text_Based_Test
Test::Result result("Charset");
- const std::vector<byte> in = get_req_bin(vars, "In");
- const std::vector<byte> expected = get_req_bin(vars, "Out");
+ const std::vector<uint8_t> in = get_req_bin(vars, "In");
+ const std::vector<uint8_t> expected = get_req_bin(vars, "Out");
std::string converted;
if(type == "UTF16-LATIN1")
@@ -365,7 +365,7 @@ class Charset_Tests : public Text_Based_Test
throw Test_Error("Unexpected header '" + type + "' in charset tests");
}
- result.test_eq("string converted successfully", std::vector<byte>(converted.begin(), converted.end()), expected);
+ result.test_eq("string converted successfully", std::vector<uint8_t>(converted.begin(), converted.end()), expected);
return result;
}
@@ -379,7 +379,7 @@ class Charset_Tests : public Text_Based_Test
result.test_throws("conversion fails for non-Latin1 characters", []()
{
// "abcdefŸabcdef"
- std::vector<byte> input = { 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x01,
+ std::vector<uint8_t> input = { 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x01,
0x78, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66
};
@@ -389,7 +389,7 @@ class Charset_Tests : public Text_Based_Test
result.test_throws("conversion fails for UTF16 string with odd number of bytes", []()
{
- std::vector<byte> input = { 0x00, 0x61, 0x00 };
+ std::vector<uint8_t> input = { 0x00, 0x61, 0x00 };
Charset::transcode(std::string(input.begin(), input.end()),
Character_Set::LATIN1_CHARSET, Character_Set::UCS2_CHARSET);
@@ -407,7 +407,7 @@ class Charset_Tests : public Text_Based_Test
result.test_throws("conversion fails for non-Latin1 characters", []()
{
// "abcdefŸabcdef"
- std::vector<byte> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC5,
+ std::vector<uint8_t> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC5,
0xB8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66
};
@@ -418,7 +418,7 @@ class Charset_Tests : public Text_Based_Test
result.test_throws("invalid utf-8 string", []()
{
// sequence truncated
- std::vector<byte> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC5 };
+ std::vector<uint8_t> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC5 };
Charset::transcode(std::string(input.begin(), input.end()),
Character_Set::LATIN1_CHARSET, Character_Set::UTF8_CHARSET);
@@ -426,7 +426,7 @@ class Charset_Tests : public Text_Based_Test
result.test_throws("invalid utf-8 string", []()
{
- std::vector<byte> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC8, 0xB8, 0x61 };
+ std::vector<uint8_t> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC8, 0xB8, 0x61 };
Charset::transcode(std::string(input.begin(), input.end()),
Character_Set::LATIN1_CHARSET, Character_Set::UTF8_CHARSET);