MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/editor/editor_tests/editor_notes_test.cpp:15–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using platform::tests_support::ScopedFile;
14
15UNIT_TEST(Notes_Smoke)
16{
17 auto const fileName = "notes.xml";
18 auto const fullFileName = base::JoinPath(GetPlatform().WritableDir(), fileName);
19 ScopedFile sf(fileName, ScopedFile::Mode::DoNotCreate);
20 {
21 auto const notes = Notes::MakeNotes(fullFileName, true);
22 notes->CreateNote(mercator::ToLatLon({1, 2}), "Some note1");
23 notes->CreateNote(mercator::ToLatLon({2, 2}), "Some note2");
24 notes->CreateNote(mercator::ToLatLon({1, 1}), "Some note3");
25 }
26 {
27 auto const notes = Notes::MakeNotes(fullFileName, true);
28 auto const result = notes->GetNotes();
29 TEST_EQUAL(result.size(), 3, ());
30 std::vector<Note> const expected{{mercator::ToLatLon({1, 2}), "Some note1"},
31 {mercator::ToLatLon({2, 2}), "Some note2"},
32 {mercator::ToLatLon({1, 1}), "Some note3"}};
33
34 auto const isEqual =
35 std::equal(result.begin(), result.end(), expected.begin(), [](Note const & lhs, Note const & rhs)
36 { return lhs.m_point.EqualDxDy(rhs.m_point, Notes::kTolerance); });
37 TEST(isEqual, ());
38 }
39}

Callers

nothing calls this directly

Calls 9

JoinPathFunction · 0.85
TESTFunction · 0.85
GetNotesMethod · 0.80
ToLatLonFunction · 0.50
CreateNoteMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
EqualDxDyMethod · 0.45

Tested by

no test coverage detected