aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_oid.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-08-04 06:32:32 -0400
committerJack Lloyd <[email protected]>2019-08-04 16:26:48 -0400
commitb7434defb0769f1f06a7b55f5435ceb690856713 (patch)
tree6e4e86f22dc01b75db8a59ad86f8b7261791a840 /src/tests/test_oid.cpp
parent67fddcd63e065eaf8bafbb15f615cbf203a305bd (diff)
Deprecate and replace OIDS::lookup
Diffstat (limited to 'src/tests/test_oid.cpp')
-rw-r--r--src/tests/test_oid.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/tests/test_oid.cpp b/src/tests/test_oid.cpp
index 42da391e0..b8c6d5d7f 100644
--- a/src/tests/test_oid.cpp
+++ b/src/tests/test_oid.cpp
@@ -26,8 +26,8 @@ Test::Result test_add_have_OID()
result.test_eq("OID 'botan-test-oid1' added successfully", Botan::OIDS::have_oid("botan-test-oid1"), true);
- result.test_eq("name of OID '1.2.345.6.666' is 'botan-test-oid1'", Botan::OIDS::name_of(Botan::OID("1.2.345.6.666"),
- "botan-test-oid1"), true);
+ result.test_eq("name of OID '1.2.345.6.666' is 'botan-test-oid1'",
+ Botan::OIDS::oid2str_or_throw(Botan::OID("1.2.345.6.666")), "botan-test-oid1");
return result;
}
@@ -42,8 +42,8 @@ Test::Result test_add_have_OID_str()
result.test_eq("OID 'botan-test-oid2' added successfully", Botan::OIDS::have_oid("botan-test-oid2"), true);
- result.test_eq("name of OID '1.2.345.6.777' is 'botan-test-oid2'", Botan::OIDS::name_of(Botan::OID("1.2.345.6.777"),
- "botan-test-oid2"), true);
+ result.test_eq("name of OID '1.2.345.6.777' is 'botan-test-oid2'",
+ Botan::OIDS::oid2str_or_throw(Botan::OID("1.2.345.6.777")), "botan-test-oid2");
return result;
}
@@ -51,21 +51,25 @@ Test::Result test_add_and_lookup()
{
Test::Result result("OID add and lookup");
- result.test_eq("OIDS::lookup returns empty string for non-existent OID object",
- Botan::OIDS::lookup(Botan::OID("1.2.345.6.888")), std::string());
+ result.test_eq("OIDS::oid2str_or_empty returns empty string for non-existent OID object",
+ Botan::OIDS::oid2str_or_empty(Botan::OID("1.2.345.6.888")), std::string());
- result.test_eq("OIDS::lookup returns empty OID for non-existent OID name", Botan::OIDS::lookup("botan-test-oid3").to_string(), Botan::OID().to_string());
+ result.test_eq("OIDS::str2oid_or_empty returns empty OID for non-existent OID name",
+ Botan::OIDS::str2oid_or_empty("botan-test-oid3").to_string(), Botan::OID().to_string());
// add oid -> string mapping
Botan::OIDS::add_oid2str(Botan::OID("1.2.345.6.888"), "botan-test-oid3");
- result.test_eq("", Botan::OIDS::lookup(Botan::OID("1.2.345.6.888")), "botan-test-oid3");
+ result.test_eq("Lookup works after adding the OID",
+ Botan::OIDS::oid2str_or_throw(Botan::OID("1.2.345.6.888")), "botan-test-oid3");
// still returns empty OID
- result.test_eq("OIDS::lookup still returns empty OID without adding name mapping", Botan::OIDS::lookup("botan-test-oid3").to_string(), Botan::OID().to_string());
+ result.test_eq("OIDS::str2oid_or_empty still returns empty OID without adding name mapping",
+ Botan::OIDS::str2oid_or_empty("botan-test-oid3").to_string(), Botan::OID().to_string());
// add string -> oid mapping
Botan::OIDS::add_str2oid(Botan::OID("1.2.345.6.888"), "botan-test-oid3");
- Botan::OIDS::lookup("botan-test-oid3");
+ result.test_eq("OIDS::str2oid_or_empty returns value after adding name mapping",
+ Botan::OIDS::str2oid_or_empty("botan-test-oid3").to_string(), Botan::OID({1,2,345,6,888}).to_string());
return result;
}