From ac179932fea5244a18547fffa5eb7f086afd3c08 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 2 Jun 2014 13:02:43 +0300 Subject: Add test and code with errors. --- tests/run | 3 +++ tests/testreport.txt | 31 ++++++++++++++++++++++++ tests/testsrc/bad/constructor1.cpp | 48 ++++++++++++++++++++++++++++++++++++++ tests/testsrc/bad/constructor1.h | 46 ++++++++++++++++++++++++++++++++++++ tests/testsrc/bad/debug1.cpp | 25 ++++++++++++++++++++ tests/testsrc/bad/debug1.h | 27 +++++++++++++++++++++ tests/testsrc/bad/debug2.cpp | 27 +++++++++++++++++++++ tests/testsrc/bad/final1.cpp | 33 ++++++++++++++++++++++++++ tests/testsrc/bad/final1.h | 29 +++++++++++++++++++++++ tests/testsrc/bad/license1.cpp | 27 +++++++++++++++++++++ tests/testsrc/bad/license1.h | 25 ++++++++++++++++++++ tests/testsrc/bad/license2.cpp | 27 +++++++++++++++++++++ tests/testsrc/bad/license2.h | 25 ++++++++++++++++++++ tests/testsrc/bad/license3.cpp | 27 +++++++++++++++++++++ tests/testsrc/bad/license3.h | 25 ++++++++++++++++++++ tests/testsrc/bad/license4.cpp | 27 +++++++++++++++++++++ tests/testsrc/bad/license4.h | 25 ++++++++++++++++++++ tests/testsrc/bad/license5.cpp | 26 +++++++++++++++++++++ tests/testsrc/bad/license5.h | 24 +++++++++++++++++++ tests/testsrc/bad/license6.cpp | 27 +++++++++++++++++++++ tests/testsrc/bad/license6.h | 25 ++++++++++++++++++++ 21 files changed, 579 insertions(+) create mode 100755 tests/run create mode 100644 tests/testreport.txt create mode 100644 tests/testsrc/bad/constructor1.cpp create mode 100644 tests/testsrc/bad/constructor1.h create mode 100644 tests/testsrc/bad/debug1.cpp create mode 100644 tests/testsrc/bad/debug1.h create mode 100644 tests/testsrc/bad/debug2.cpp create mode 100644 tests/testsrc/bad/final1.cpp create mode 100644 tests/testsrc/bad/final1.h create mode 100644 tests/testsrc/bad/license1.cpp create mode 100644 tests/testsrc/bad/license1.h create mode 100644 tests/testsrc/bad/license2.cpp create mode 100644 tests/testsrc/bad/license2.h create mode 100644 tests/testsrc/bad/license3.cpp create mode 100644 tests/testsrc/bad/license3.h create mode 100644 tests/testsrc/bad/license4.cpp create mode 100644 tests/testsrc/bad/license4.h create mode 100644 tests/testsrc/bad/license5.cpp create mode 100644 tests/testsrc/bad/license5.h create mode 100644 tests/testsrc/bad/license6.cpp create mode 100644 tests/testsrc/bad/license6.h diff --git a/tests/run b/tests/run new file mode 100755 index 0000000..e9f2c7d --- /dev/null +++ b/tests/run @@ -0,0 +1,3 @@ +#!/bin/bash + +../run/bin/mplint testsrc >testreport.txt diff --git a/tests/testreport.txt b/tests/testreport.txt new file mode 100644 index 0000000..322eda1 --- /dev/null +++ b/tests/testreport.txt @@ -0,0 +1,31 @@ +[testsrc/bad/final1.cpp:25]: V007: Need add final or notfinal into class declaration +[testsrc/bad/final1.cpp:30]: V007: Need add final or notfinal into class declaration +[testsrc/bad/license1.cpp:1]: V005: Should be license header +[testsrc/bad/license2.cpp:2]: V005: Should be 'The ManaPlus Client' in header +[testsrc/bad/license3.cpp:19]: V005: License version not found. It must be GPL 2 +[testsrc/bad/license4.cpp:4]: V005: Missing ManaPlus developers copyrights +[testsrc/bad/license5.cpp:3]: V005: Missing copyrights section +[testsrc/bad/license6.cpp:5]: V005: Missing "This file is part of The ManaPlus Client." +[testsrc/bad/constructor1.cpp:34]: V006: Add space between constructor and ":". +[testsrc/bad/constructor1.cpp:35]: V006: Wrong align in initialisation list. +[testsrc/bad/constructor1.cpp:44]: V006: Wrong align in initialisation list. +[testsrc/bad/constructor1.cpp:25]: V007: Need add final or notfinal into class declaration +[testsrc/bad/constructor1.cpp:32]: V007: Need add final or notfinal into class declaration +[testsrc/bad/constructor1.cpp:41]: 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/debug1.h:23]: V003: Dont use #include "debug.h" in .h files. Probably need replace it to #include "localconsts.h" +[testsrc/bad/license1.h:1]: V005: Should be license header +[testsrc/bad/license2.h:2]: V005: Should be 'The ManaPlus Client' in header +[testsrc/bad/license3.h:19]: V005: License version not found. It must be GPL 2 +[testsrc/bad/license4.h:4]: V005: Missing ManaPlus developers copyrights +[testsrc/bad/license5.h:3]: V005: Missing copyrights section +[testsrc/bad/license6.h:5]: V005: Missing "This file is part of The ManaPlus Client." +[testsrc/bad/constructor1.h:32]: V006: Add space between constructor and ":". +[testsrc/bad/constructor1.h:33]: V006: Wrong align in initialisation list. +[testsrc/bad/constructor1.h:42]: V006: Wrong align in initialisation list. +[testsrc/bad/constructor1.h:23]: V007: Need add final or notfinal into class declaration +[testsrc/bad/constructor1.h:30]: V007: Need add final or notfinal into class declaration +[testsrc/bad/constructor1.h:39]: V007: Need add final or notfinal into class declaration +[testsrc/bad/debug1.cpp:25]: V004: Missing #include "debug.h". It need for profiling and memory debugging. +[testsrc/bad/debug2.cpp:23]: V004: Last include must be #include "debug.h" diff --git a/tests/testsrc/bad/constructor1.cpp b/tests/testsrc/bad/constructor1.cpp new file mode 100644 index 0000000..4d19fe5 --- /dev/null +++ b/tests/testsrc/bad/constructor1.cpp @@ -0,0 +1,48 @@ +/* + * 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +class Test1 +{ + Test1::Test1() + { + } +} + +struct Test2 +{ + Test2::Test2(): + data1(), + data2() + { + } +} + +struct Test3 +{ + Test3::Test3() : + data1(), + data2() + { + } +} diff --git a/tests/testsrc/bad/constructor1.h b/tests/testsrc/bad/constructor1.h new file mode 100644 index 0000000..a61f0d9 --- /dev/null +++ b/tests/testsrc/bad/constructor1.h @@ -0,0 +1,46 @@ +/* + * 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 . + */ + +#include "lintmanager.h" + +class Test1 +{ + Test1::Test1() + { + } +} + +struct Test2 +{ + Test2::Test2(): + data1(), + data2() + { + } +} + +struct Test3 +{ + Test3::Test3() : + data1(), + data2() + { + } +} diff --git a/tests/testsrc/bad/debug1.cpp b/tests/testsrc/bad/debug1.cpp new file mode 100644 index 0000000..d96a5f4 --- /dev/null +++ b/tests/testsrc/bad/debug1.cpp @@ -0,0 +1,25 @@ +/* + * 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/debug1.h b/tests/testsrc/bad/debug1.h new file mode 100644 index 0000000..b6812d4 --- /dev/null +++ b/tests/testsrc/bad/debug1.h @@ -0,0 +1,27 @@ +/* + * 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/debug2.cpp b/tests/testsrc/bad/debug2.cpp new file mode 100644 index 0000000..f442b98 --- /dev/null +++ b/tests/testsrc/bad/debug2.cpp @@ -0,0 +1,27 @@ +/* + * 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 . + */ + +#include "debug.h" + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/final1.cpp b/tests/testsrc/bad/final1.cpp new file mode 100644 index 0000000..3e17bb2 --- /dev/null +++ b/tests/testsrc/bad/final1.cpp @@ -0,0 +1,33 @@ +/* + * 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +class Test1 +{ + Test1(); +} + +class Test2 : public Test1 +{ + Test2(); +} diff --git a/tests/testsrc/bad/final1.h b/tests/testsrc/bad/final1.h new file mode 100644 index 0000000..9ced5ae --- /dev/null +++ b/tests/testsrc/bad/final1.h @@ -0,0 +1,29 @@ +/* + * 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 . + */ + +#include "lintmanager.h" + +class Test1 +{ +} + +class Test2 : public Test1 +{ +} diff --git a/tests/testsrc/bad/license1.cpp b/tests/testsrc/bad/license1.cpp new file mode 100644 index 0000000..8378e48 --- /dev/null +++ b/tests/testsrc/bad/license1.cpp @@ -0,0 +1,27 @@ +/*** + * 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license1.h b/tests/testsrc/bad/license1.h new file mode 100644 index 0000000..d492616 --- /dev/null +++ b/tests/testsrc/bad/license1.h @@ -0,0 +1,25 @@ +/*** + * 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license2.cpp b/tests/testsrc/bad/license2.cpp new file mode 100644 index 0000000..f27871f --- /dev/null +++ b/tests/testsrc/bad/license2.cpp @@ -0,0 +1,27 @@ +/* + * The anaPlus 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license2.h b/tests/testsrc/bad/license2.h new file mode 100644 index 0000000..05977b3 --- /dev/null +++ b/tests/testsrc/bad/license2.h @@ -0,0 +1,25 @@ +/* + * The anaPlus 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license3.cpp b/tests/testsrc/bad/license3.cpp new file mode 100644 index 0000000..b55e807 --- /dev/null +++ b/tests/testsrc/bad/license3.cpp @@ -0,0 +1,27 @@ +/* + * 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 3 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license3.h b/tests/testsrc/bad/license3.h new file mode 100644 index 0000000..903460a --- /dev/null +++ b/tests/testsrc/bad/license3.h @@ -0,0 +1,25 @@ +/* + * 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 3 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license4.cpp b/tests/testsrc/bad/license4.cpp new file mode 100644 index 0000000..09e87b0 --- /dev/null +++ b/tests/testsrc/bad/license4.cpp @@ -0,0 +1,27 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license4.h b/tests/testsrc/bad/license4.h new file mode 100644 index 0000000..89071d9 --- /dev/null +++ b/tests/testsrc/bad/license4.h @@ -0,0 +1,25 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license5.cpp b/tests/testsrc/bad/license5.cpp new file mode 100644 index 0000000..807835a --- /dev/null +++ b/tests/testsrc/bad/license5.cpp @@ -0,0 +1,26 @@ +/* + * The ManaPlus Client + * aaaaaaaaa + * 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license5.h b/tests/testsrc/bad/license5.h new file mode 100644 index 0000000..b89ac84 --- /dev/null +++ b/tests/testsrc/bad/license5.h @@ -0,0 +1,24 @@ +/* + * The ManaPlus Client + * bbbbbbbbb + * 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license6.cpp b/tests/testsrc/bad/license6.cpp new file mode 100644 index 0000000..32946a1 --- /dev/null +++ b/tests/testsrc/bad/license6.cpp @@ -0,0 +1,27 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * file is part of + * + * 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 . + */ + +#include "lintmanager.h" + +#include "debug.h" + +void func() +{ +} diff --git a/tests/testsrc/bad/license6.h b/tests/testsrc/bad/license6.h new file mode 100644 index 0000000..d36ff19 --- /dev/null +++ b/tests/testsrc/bad/license6.h @@ -0,0 +1,25 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * file is part of + * + * 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 . + */ + +#include "lintmanager.h" + +void func() +{ +} -- cgit v1.2.3-60-g2f50