MCPcopy Create free account
hub / github.com/davisking/dlib / test_vector

Function test_vector

dlib/test/serialize.cpp:647–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645
646 template <typename T>
647 void test_vector (
648 )
649 {
650 std::vector<T> a, b;
651
652 for (int i = -10; i < 30; ++i)
653 {
654 a.push_back(i);
655 }
656
657 ostringstream sout;
658 dlib::serialize(a, sout);
659 istringstream sin(sout.str());
660
661 dlib::deserialize(b, sin);
662
663
664 DLIB_TEST(a.size() == b.size());
665 DLIB_TEST(a.size() == 40);
666 for (unsigned long i = 0; i < a.size(); ++i)
667 {
668 DLIB_TEST(a[i] == b[i]);
669 }
670
671 std::vector<T> c;
672 sout.str("");
673 dlib::serialize(c, sout);
674 sin.str(sout.str());
675 dlib::deserialize(a, sin);
676 DLIB_TEST(a.size() == 0);
677 DLIB_TEST(c.size() == 0);
678 }
679
680 void test_std_array (
681 )

Callers

nothing calls this directly

Calls 5

serializeFunction · 0.70
deserializeFunction · 0.70
push_backMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected