Revert "Device/Driver/LX: Add small delay after baud rate change"
[xcsoar.git] / test / src / TestIGCFilenameFormatter.cpp
blob59894237adf4a4f4d62e1dc96b8b7f8bf8459f57
1 /* Copyright_License {
3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2013 The XCSoar Project
5 A detailed list of copyright holders can be found in the file "AUTHORS".
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "Formatter/IGCFilenameFormatter.hpp"
24 #include "Util/StringUtil.hpp"
25 #include "Time/BrokenDate.hpp"
26 #include "TestUtil.hpp"
28 static void
29 TestShort()
31 TCHAR buffer[256];
33 FormatIGCFilename(buffer, BrokenDate(2012, 2, 10), _T('T'), _T("ABC"), 1);
34 ok1(StringIsEqual(buffer, _T("22ATABC1.igc")));
36 FormatIGCFilename(buffer, BrokenDate(2010, 1, 1), _T('X'), _T("234"), 15);
37 ok1(StringIsEqual(buffer, _T("011X234F.igc")));
39 FormatIGCFilename(buffer, BrokenDate(2009, 12, 1), _T('X'), _T("234"), 35);
40 ok1(StringIsEqual(buffer, _T("9C1X234Z.igc")));
43 static void
44 TestLong()
46 TCHAR buffer[256];
48 FormatIGCFilenameLong(buffer, BrokenDate(2012, 2, 10),
49 _T("XYZ"), _T("ABC"), 1);
50 ok1(StringIsEqual(buffer, _T("2012-02-10-XYZ-ABC-01.igc")));
52 FormatIGCFilenameLong(buffer, BrokenDate(2010, 1, 1),
53 _T("BLA"), _T("234"), 15);
54 ok1(StringIsEqual(buffer, _T("2010-01-01-BLA-234-15.igc")));
56 FormatIGCFilenameLong(buffer, BrokenDate(2009, 12, 1),
57 _T("S45"), _T("234"), 35);
58 ok1(StringIsEqual(buffer, _T("2009-12-01-S45-234-35.igc")));
61 static void
62 TestChar()
64 TCHAR buffer[256];
66 FormatIGCFilename(buffer, BrokenDate(2012, 2, 10), 'T', "ABC", 1);
67 ok1(StringIsEqual(buffer, _T("22ATABC1.igc")));
69 FormatIGCFilenameLong(buffer, BrokenDate(2012, 2, 10),
70 "XYZ", "ABC", 1);
71 ok1(StringIsEqual(buffer, _T("2012-02-10-XYZ-ABC-01.igc")));
74 int
75 main(int argc, char **argv)
77 plan_tests(8);
79 TestShort();
80 TestLong();
82 TestChar();
84 return exit_status();