[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r4046 - in trunk/pingus: . src/pingus test
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r4046 - in trunk/pingus: . src/pingus test |
Date: |
Fri, 6 Nov 2009 00:43:43 +0100 |
Author: grumbel
Date: 2009-11-06 00:43:42 +0100 (Fri, 06 Nov 2009)
New Revision: 4046
Modified:
trunk/pingus/SConscript
trunk/pingus/src/pingus/line_iterator.cpp
trunk/pingus/test/evdev_device_test.cpp
trunk/pingus/test/input_test.cpp
trunk/pingus/test/line_iterator_test.cpp
trunk/pingus/test/memory_pool_test.cpp
trunk/pingus/test/rect_merger_test.cpp
trunk/pingus/test/utf8_test.cpp
Log:
Build test cases via SCons
Modified: trunk/pingus/SConscript
===================================================================
--- trunk/pingus/SConscript 2009-11-05 23:30:58 UTC (rev 4045)
+++ trunk/pingus/SConscript 2009-11-05 23:43:42 UTC (rev 4046)
@@ -304,5 +304,8 @@
Glob('src/util/*.cpp') + \
env['optional_sources'])
env.Program('pingus', ['src/main.cpp', libpingus])
-
+
+ for filename in Glob("test/*_test.cpp", strings=True):
+ env.Program(filename[:-4], [filename, libpingus])
+
## EOF ##
Modified: trunk/pingus/src/pingus/line_iterator.cpp
===================================================================
--- trunk/pingus/src/pingus/line_iterator.cpp 2009-11-05 23:30:58 UTC (rev
4045)
+++ trunk/pingus/src/pingus/line_iterator.cpp 2009-11-05 23:43:42 UTC (rev
4046)
@@ -16,7 +16,6 @@
#include "pingus/line_iterator.hpp"
-
LineIterator::LineIterator(const std::string& str)
: first(str.begin()),
last(str.end()),
Modified: trunk/pingus/test/evdev_device_test.cpp
===================================================================
--- trunk/pingus/test/evdev_device_test.cpp 2009-11-05 23:30:58 UTC (rev
4045)
+++ trunk/pingus/test/evdev_device_test.cpp 2009-11-05 23:43:42 UTC (rev
4046)
@@ -14,26 +14,26 @@
// 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 "evdev_device_test.hpp"
+#include "engine/input/evdev/evdev_device.hpp"
// g++ -D__TEST__ evdev_device.cpp -o evdev -Wall -Werror
int main(int argc, char** argv)
{
if (argc != 2)
- {
- std::cout << "Usage: evdev FILENAME" << std::endl;
- }
+ {
+ std::cout << "Usage: evdev FILENAME" << std::endl;
+ }
else
+ {
+ std::cout << "EvdevDevice: " << argv[1] << std::endl;
+
+ Input::EvdevDevice dev(argv[1]);
+ while(true)
{
- std::cout << "EvdevDevice: " << argv[1] << std::endl;
-
- Input::EvdevDevice dev(argv[1]);
- while(true)
- {
- dev.update(0.0f);
- }
+ dev.update(0.0f);
}
+ }
return 0;
}
Modified: trunk/pingus/test/input_test.cpp
===================================================================
--- trunk/pingus/test/input_test.cpp 2009-11-05 23:30:58 UTC (rev 4045)
+++ trunk/pingus/test/input_test.cpp 2009-11-05 23:43:42 UTC (rev 4046)
@@ -1,33 +1,63 @@
+// Pingus - A free Lemmings clone
+// Copyright (C) 1998-2009 Ingo Ruhnke <address@hidden>
+//
+// 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
+// (at your option) 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 <iostream>
#include <stdexcept>
-#include "SDL.h"
-#include "input/manager.hpp"
-#include "input/controller.hpp"
+#include <SDL.h>
+#include "util/pathname.hpp"
+#include "engine/input/manager.hpp"
+#include "engine/input/controller.hpp"
+
int main()
{
- try {
- if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
- std::cerr << "Unable to init SDL: " << SDL_GetError() << std::endl;
- exit(1);
- }
- atexit(SDL_Quit);
+ try
+ {
+ if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
+ {
+ std::cerr << "Unable to init SDL: " << SDL_GetError() << std::endl;
+ exit(1);
+ }
+ atexit(SDL_Quit);
- SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, 0);
+ SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, 0);
- Input::Manager manager;
+ Input::Manager manager;
- Input::Controller* controller
- = manager.create_controller("../../data/controller/input2.scm");
+ Input::Controller* controller
+ = manager.create_controller(Pathname("../data/controller/input2.scm",
Pathname::SYSTEM_PATH));
- while(true)
+ while(true)
{
- std::vector<Input::Event> events = controller->poll_events();
+ std::vector<Input::Event> events;
- manager.update(0.033);
+ controller->poll_events(events);
+
+ for(std::vector<Input::Event>::iterator i = events.begin(); i !=
events.end(); ++i)
+ {
+ // insert code here
+ }
+
+ manager.update(0.033f);
SDL_Flip(screen);
}
- } catch (std::exception& err) {
+ }
+ catch (std::exception& err)
+ {
std::cout << "Exception: " << err.what() << std::endl;
}
Modified: trunk/pingus/test/line_iterator_test.cpp
===================================================================
--- trunk/pingus/test/line_iterator_test.cpp 2009-11-05 23:30:58 UTC (rev
4045)
+++ trunk/pingus/test/line_iterator_test.cpp 2009-11-05 23:43:42 UTC (rev
4046)
@@ -14,12 +14,10 @@
// 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 "line_iterator_test.hpp"
-
-// g++ line_iterator.cpp -o line_iterator -D__TEST__ -Wall -Werror -ansi
-pedantic
-
#include <iostream>
+#include "pingus/line_iterator.hpp"
+
void test(const std::string& str)
{
std::cout << "Testing: " << std::endl;
Modified: trunk/pingus/test/memory_pool_test.cpp
===================================================================
--- trunk/pingus/test/memory_pool_test.cpp 2009-11-05 23:30:58 UTC (rev
4045)
+++ trunk/pingus/test/memory_pool_test.cpp 2009-11-05 23:43:42 UTC (rev
4046)
@@ -14,13 +14,10 @@
// 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 "memory_pool_test.hpp"
-
-// g++ -Wall -Werror -ansi -pedantic -O2 -g memory_pool_test.cpp -o
memory_pool_test
-
#include <iostream>
-#include "memory_pool.hpp"
+#include "util/memory_pool.hpp"
+
struct Thing {
int i;
Modified: trunk/pingus/test/rect_merger_test.cpp
===================================================================
--- trunk/pingus/test/rect_merger_test.cpp 2009-11-05 23:30:58 UTC (rev
4045)
+++ trunk/pingus/test/rect_merger_test.cpp 2009-11-05 23:43:42 UTC (rev
4046)
@@ -14,12 +14,11 @@
// 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 "rect_merger_test.hpp"
-
-// g++ -Wall -O2 -D__TEST__ rect_merger.cpp ../math/rect.cpp
../math/origin.cpp -o rect_merger
-
+#include <iostream>
#include <stdlib.h>
+#include "engine/display/rect_merger.hpp"
+
int main(int argc, char** argv)
{
int t = 1216020230; // 20
Modified: trunk/pingus/test/utf8_test.cpp
===================================================================
--- trunk/pingus/test/utf8_test.cpp 2009-11-05 23:30:58 UTC (rev 4045)
+++ trunk/pingus/test/utf8_test.cpp 2009-11-05 23:43:42 UTC (rev 4046)
@@ -14,22 +14,24 @@
// 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 "utf8_test.hpp"
+#include <iostream>
+#include "util/utf8.hpp"
+
int main(int argc, char** argv)
{
if (argc != 2)
- {
- std::cout << "Usage: " << argv[0] << " TEXT" << std::endl;
- }
+ {
+ std::cout << "Usage: " << argv[0] << " TEXT" << std::endl;
+ }
else
- {
- std::cout << "ASCII: " << std::string(argv[1]).length() << std::endl;
- std::cout << "UTF8: " << UTF8::length(argv[1]) << std::endl;
+ {
+ std::cout << "length in ASCII characters: " <<
std::string(argv[1]).length() << std::endl;
+ std::cout << "length in UTF8 characters: " << UTF8::length(argv[1]) <<
std::endl;
- std::string res = UTF8::substr(argv[1], 1, 1);
- std::cout << "substr: " << res.length() << " " << res << std::endl;
- }
+ std::string res = UTF8::substr(argv[1], 1, 1);
+ std::cout << "substr: " << res.length() << " " << res << std::endl;
+ }
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r4046 - in trunk/pingus: . src/pingus test,
grumbel at BerliOS <=