| 13 | using platform::tests_support::ScopedFile; |
| 14 | |
| 15 | UNIT_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 | } |