diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testreport.txt | 9 | ||||
-rw-r--r-- | tests/testsrc/bad/formatting.cpp | 51 | ||||
-rw-r--r-- | tests/testsrc/bad/formatting.h | 49 | ||||
-rw-r--r-- | tests/testsrc/bad/formatting2.cpp | 50 | ||||
-rw-r--r-- | tests/testsrc/good/formatting.cpp | 51 | ||||
-rw-r--r-- | tests/testsrc/good/formatting.h | 49 | ||||
-rw-r--r-- | tests/testsrc/good/formatting2.cpp | 50 |
7 files changed, 309 insertions, 0 deletions
diff --git a/tests/testreport.txt b/tests/testreport.txt index 69b59bf..9a5df06 100644 --- a/tests/testreport.txt +++ b/tests/testreport.txt @@ -18,6 +18,13 @@ [testsrc/bad/final1.cpp:30]: V007: Need add final or notfinal into class declaration [testsrc/bad/final1.h:23]: V007: Need add final or notfinal into class declaration [testsrc/bad/final1.h:27]: V007: Need add final or notfinal into class declaration +[testsrc/bad/formatting2.cpp:28]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. +[testsrc/bad/formatting.cpp:27]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. +[testsrc/bad/formatting.cpp:35]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. +[testsrc/bad/formatting.cpp:45]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. +[testsrc/bad/formatting.h:25]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. +[testsrc/bad/formatting.h:33]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. +[testsrc/bad/formatting.h:43]: V011: Wrong public/protected/private formatting. Must be 4 space from previous level. [testsrc/bad/include1.cpp:21]: V008: Wrong include #include "lintmanager1.h". Probably you should use path from src dir, or use #include <file.ext> [testsrc/bad/include1.cpp:23]: V008: Wrong include #include "include1.h". Probably you should use path from src dir, or use #include <file.ext> [testsrc/bad/include1.h:21]: V008: Wrong include #include "lintmanager1.h". Probably you should use path from src dir, or use #include <file.ext> @@ -38,5 +45,7 @@ [testsrc/bad/uk.po:2253]: V010: Useless space at end of translation line. [testsrc/bad/uk.po:2257]: V010: Wrong character at end of translation line. [testsrc/bad/uk.po:44]: V010: Missing ### in translation. +[testsrc/bad/uk.po:496]: V010: Wrong character at end of translation line. [testsrc/bad/uk.po:919]: V010: Useless space at end of translation line. [testsrc/bad/uk.po:98]: V010: Useless space at end of translation line. +[testsrc/good/ru.po:1838]: V010: Wrong character at end of translation line. diff --git a/tests/testsrc/bad/formatting.cpp b/tests/testsrc/bad/formatting.cpp new file mode 100644 index 0000000..2f0bda5 --- /dev/null +++ b/tests/testsrc/bad/formatting.cpp @@ -0,0 +1,51 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "lintmanager.h" + +#include "debug.h" + +class Test1 final +{ +public: + Test1::Test1() + { + } +} + +struct Test2 final +{ +protected: + Test2::Test2() : + data1(), + data2() + { + } +} + +struct Test3 final +{ + private: + Test3::Test3() : + data1(), + data2() + { + } +} diff --git a/tests/testsrc/bad/formatting.h b/tests/testsrc/bad/formatting.h new file mode 100644 index 0000000..086e1f7 --- /dev/null +++ b/tests/testsrc/bad/formatting.h @@ -0,0 +1,49 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "lintmanager.h" + +class Test1 final +{ +public: + Test1::Test1() + { + } +} + +struct Test2 final +{ + protected: + Test2::Test2() : + data1(), + data2() + { + } +} + +struct Test3 final +{ + private: + Test3::Test3() : + data1(), + data2() + { + } +} diff --git a/tests/testsrc/bad/formatting2.cpp b/tests/testsrc/bad/formatting2.cpp new file mode 100644 index 0000000..ccf6e86 --- /dev/null +++ b/tests/testsrc/bad/formatting2.cpp @@ -0,0 +1,50 @@ +/* + * The ManaPlus Client + * Copyright (C) 2010 The Mana Developers + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "debug.h" + +namespace +{ + static class SortPartyFunctor final + { + public: + bool operator() (const PartyMember *const p1, + const PartyMember *const p2) const + { + if (!p1 || !p2) + return false; + if (p1->getLeader()) + return true; + if (p2->getLeader()) + return false; + + if (p1->getName() != p2->getName()) + { + std::string s1 = p1->getName(); + std::string s2 = p2->getName(); + toLower(s1); + toLower(s2); + return s1 < s2; + } + return false; + } + } partySorter; +} // namespace diff --git a/tests/testsrc/good/formatting.cpp b/tests/testsrc/good/formatting.cpp new file mode 100644 index 0000000..2819d56 --- /dev/null +++ b/tests/testsrc/good/formatting.cpp @@ -0,0 +1,51 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "lintmanager.h" + +#include "debug.h" + +class Test1 final +{ + public: + Test1::Test1() + { + } +} + +struct Test2 final +{ + protected: + Test2::Test2() : + data1(), + data2() + { + } +} + +struct Test3 final +{ + private: + Test3::Test3() : + data1(), + data2() + { + } +} diff --git a/tests/testsrc/good/formatting.h b/tests/testsrc/good/formatting.h new file mode 100644 index 0000000..df123d2 --- /dev/null +++ b/tests/testsrc/good/formatting.h @@ -0,0 +1,49 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "lintmanager.h" + +class Test1 final +{ + public: + Test1::Test1() + { + } +} + +struct Test2 final +{ + protected: + Test2::Test2() : + data1(), + data2() + { + } +} + +struct Test3 final +{ + private: + Test3::Test3() : + data1(), + data2() + { + } +} diff --git a/tests/testsrc/good/formatting2.cpp b/tests/testsrc/good/formatting2.cpp new file mode 100644 index 0000000..e790ade --- /dev/null +++ b/tests/testsrc/good/formatting2.cpp @@ -0,0 +1,50 @@ +/* + * The ManaPlus Client + * Copyright (C) 2010 The Mana Developers + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "debug.h" + +namespace +{ + static class SortPartyFunctor final + { + public: + bool operator() (const PartyMember *const p1, + const PartyMember *const p2) const + { + if (!p1 || !p2) + return false; + if (p1->getLeader()) + return true; + if (p2->getLeader()) + return false; + + if (p1->getName() != p2->getName()) + { + std::string s1 = p1->getName(); + std::string s2 = p2->getName(); + toLower(s1); + toLower(s2); + return s1 < s2; + } + return false; + } + } partySorter; +} // namespace |