MCPcopy Create free account
hub / github.com/InoriRus/Kyty / test_cpp14

Function test_cpp14

source/unit_test/src/core/UnitTestCoreString.cpp:895–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893}
894
895void test_cpp14()
896{
897 StringList s = {U"a", U"b", U"cd"};
898
899 EXPECT_EQ(s.Size(), 3U);
900 EXPECT_EQ(s.At(0), "a");
901 EXPECT_EQ(s.At(1), "b");
902 EXPECT_EQ(s.At(2), "cd");
903
904 String ss;
905 for (const auto& str: s)
906 {
907 ss += str;
908 }
909
910 EXPECT_EQ(ss, U"abcd");
911
912 uint32_t int_c[] = {0xEE, 0xD0B0, 0x20FFF};
913 String s1 = String::FromUtf8("î킰𠿿");
914 String s2 = U"î킰𠿿";
915 String s3 = String::FromUtf16(u"î킰𠿿");
916
917 int i = 0;
918 i = 0;
919 for (auto ch: s1)
920 {
921 EXPECT_EQ(ch, int_c[i++]);
922 }
923 i = 0;
924 for (auto& ch: s1)
925 {
926 EXPECT_EQ(ch, int_c[i++]);
927 }
928 i = 0;
929 for (const auto& ch: s1)
930 {
931 EXPECT_EQ(ch, int_c[i++]);
932 }
933 i = 0;
934 for (auto ch: s2)
935 {
936 EXPECT_EQ(ch, int_c[i++]);
937 }
938 i = 0;
939 for (auto& ch: s2)
940 {
941 EXPECT_EQ(ch, int_c[i++]);
942 }
943 i = 0;
944 for (const auto& ch: s2)
945 {
946 EXPECT_EQ(ch, int_c[i++]);
947 }
948 i = 0;
949 for (auto ch: s3)
950 {
951 EXPECT_EQ(ch, int_c[i++]);
952 }

Callers 1

TESTFunction · 0.70

Calls 3

AtMethod · 0.80
SizeMethod · 0.45
HashMethod · 0.45

Tested by

no test coverage detected