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

Function test_cpp14

source/unit_test/src/core/UnitTestCoreString8.cpp:634–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632}
633
634void test_cpp14()
635{
636 StringList8 s = {"a", "b", "cd"};
637
638 EXPECT_EQ(s.Size(), 3U);
639 EXPECT_EQ(s.At(0), "a");
640 EXPECT_EQ(s.At(1), "b");
641 EXPECT_EQ(s.At(2), "cd");
642
643 String8 ss;
644 for (const auto& str: s)
645 {
646 ss += str;
647 }
648
649 EXPECT_EQ(ss, "abcd");
650
651 uint8_t int_c[] = {0xc3, 0xae, 0xed, 0x82, 0xb0, 0xf0, 0xa0, 0xbf, 0xbf};
652 String8 s1 = String8("î킰𠿿");
653 String8 s2 = "î킰𠿿";
654
655 int i = 0;
656 i = 0;
657 for (auto ch: s1)
658 {
659 EXPECT_EQ(ch, static_cast<char>(int_c[i++]));
660 }
661 i = 0;
662 for (auto& ch: s1)
663 {
664 EXPECT_EQ(ch, static_cast<char>(int_c[i++]));
665 }
666 i = 0;
667 for (const auto& ch: s1)
668 {
669 EXPECT_EQ(ch, static_cast<char>(int_c[i++]));
670 }
671 i = 0;
672 for (auto ch: s2)
673 {
674 EXPECT_EQ(ch, static_cast<char>(int_c[i++]));
675 }
676 i = 0;
677 for (auto& ch: s2)
678 {
679 EXPECT_EQ(ch, static_cast<char>(int_c[i++]));
680 }
681 i = 0;
682 for (const auto& ch: s2)
683 {
684 EXPECT_EQ(ch, static_cast<char>(int_c[i++]));
685 }
686 i = 0;
687
688 EXPECT_EQ(s1, s2);
689
690 EXPECT_EQ(s1.Hash(), s2.Hash());
691

Callers 1

TESTFunction · 0.70

Calls 4

String8Class · 0.85
AtMethod · 0.80
SizeMethod · 0.45
HashMethod · 0.45

Tested by

no test coverage detected