2
* Copyright 2019 by its authors. See AUTHORS.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
25
#include "eina_cxx_suite.h"
27
EFL_START_TEST(eina_cxx_stringshare_constructors)
29
efl::eina::eina_init eina_init;
31
efl::eina::stringshare string1;
32
ck_assert(string1.empty());
34
efl::eina::stringshare string2("string");
35
ck_assert(string2.size() == 6);
36
ck_assert(string2 == "string");
38
efl::eina::stringshare string3(string2);
39
ck_assert(string2 == string3);
41
efl::eina::stringshare string4(string3.begin(), string3.end());
42
ck_assert(string2 == string3);
46
EFL_START_TEST(eina_cxx_stringshare_iterators)
48
efl::eina::eina_init eina_init;
50
const char str[] = "string";
51
const char rstr[] = "gnirts";
53
efl::eina::stringshare string(str);
54
ck_assert(string.size() == 6);
55
ck_assert(string == str);
57
ck_assert(std::equal(string.begin(), string.end(), str));
58
ck_assert(std::equal(string.rbegin(), string.rend(), rstr));
59
ck_assert(std::equal(string.cbegin(), string.cend(), str));
60
ck_assert(std::equal(string.crbegin(), string.crend(), rstr));
65
eina_test_stringshare(TCase *tc)
67
tcase_add_test(tc, eina_cxx_stringshare_constructors);
68
tcase_add_test(tc, eina_cxx_stringshare_iterators);