From cda991290f8249db255c384ac1dfaa3c9d4acb70 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 5 Sep 2023 16:24:58 -0400 Subject: [PATCH] refactor: update schema to scheme in c api --- include/ada_c.h | 2 +- src/ada_c.cpp | 2 +- tests/ada_c.cpp | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/ada_c.h b/include/ada_c.h index a8abd1e4a..040915518 100644 --- a/include/ada_c.h +++ b/include/ada_c.h @@ -69,7 +69,7 @@ ada_string ada_get_pathname(ada_url result); ada_string ada_get_search(ada_url result); ada_string ada_get_protocol(ada_url result); uint8_t ada_get_host_type(ada_url result); -uint8_t ada_get_schema_type(ada_url result); +uint8_t ada_get_scheme_type(ada_url result); // url_aggregator setters // if ada_is_valid(result)) is false, the setters have no effect diff --git a/src/ada_c.cpp b/src/ada_c.cpp index 111a2e8d8..664371baa 100644 --- a/src/ada_c.cpp +++ b/src/ada_c.cpp @@ -218,7 +218,7 @@ uint8_t ada_get_host_type(ada_url result) noexcept { return r->host_type; } -uint8_t ada_get_schema_type(ada_url result) noexcept { +uint8_t ada_get_scheme_type(ada_url result) noexcept { ada::result& r = get_instance(result); if (!r) { return 0; diff --git a/tests/ada_c.cpp b/tests/ada_c.cpp index b1f6a77db..c1208fdc0 100644 --- a/tests/ada_c.cpp +++ b/tests/ada_c.cpp @@ -210,50 +210,50 @@ TEST(ada_c, ada_clear_search) { SUCCEED(); } -TEST(ada_c, ada_get_schema_type) { +TEST(ada_c, ada_get_scheme_type) { std::string_view input; ada_url out; input = "http://www.google.com"; out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 0); + ASSERT_EQ(ada_get_scheme_type(out), 0); input = "notspecial://www.google.com"; ada_free(out); out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 1); + ASSERT_EQ(ada_get_scheme_type(out), 1); input = "https://www.google.com"; ada_free(out); out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 2); + ASSERT_EQ(ada_get_scheme_type(out), 2); input = "ws://www.google.com/ws"; ada_free(out); out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 3); + ASSERT_EQ(ada_get_scheme_type(out), 3); input = "ftp://www.google.com/file.txt"; ada_free(out); out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 4); + ASSERT_EQ(ada_get_scheme_type(out), 4); input = "wss://www.google.com/wss"; ada_free(out); out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 5); + ASSERT_EQ(ada_get_scheme_type(out), 5); input = "file:///foo/bar"; ada_free(out); out = ada_parse(input.data(), input.size()); ASSERT_TRUE(ada_is_valid(out)); - ASSERT_EQ(ada_get_schema_type(out), 6); + ASSERT_EQ(ada_get_scheme_type(out), 6); ada_free(out); SUCCEED();