From 25f33e77d2254791d76cc84f0f9e67e9cccf1a67 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Mar 2008 10:58:54 +0000 Subject: added first steps to building some unit tests. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@920 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UnitTests/switches.inc | 0 Game/Code/UnitTests/test_libraries.compiled | 5 + Game/Code/UnitTests/test_libraries.lpi | 299 +++++++++++++++++++++++++ Game/Code/UnitTests/test_libraries.lpi.bak | 299 +++++++++++++++++++++++++ Game/Code/UnitTests/test_libraries.lpr | 31 +++ Game/Code/UnitTests/testsqllite.pas | 84 +++++++ Game/Code/UnitTests/testsqllite.ppu | Bin 0 -> 2366 bytes Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst | 52 ++--- 8 files changed, 744 insertions(+), 26 deletions(-) create mode 100644 Game/Code/UnitTests/switches.inc create mode 100644 Game/Code/UnitTests/test_libraries.compiled create mode 100644 Game/Code/UnitTests/test_libraries.lpi create mode 100644 Game/Code/UnitTests/test_libraries.lpi.bak create mode 100644 Game/Code/UnitTests/test_libraries.lpr create mode 100644 Game/Code/UnitTests/testsqllite.pas create mode 100644 Game/Code/UnitTests/testsqllite.ppu (limited to 'Game/Code') diff --git a/Game/Code/UnitTests/switches.inc b/Game/Code/UnitTests/switches.inc new file mode 100644 index 00000000..e69de29b diff --git a/Game/Code/UnitTests/test_libraries.compiled b/Game/Code/UnitTests/test_libraries.compiled new file mode 100644 index 00000000..6efc7c42 --- /dev/null +++ b/Game/Code/UnitTests/test_libraries.compiled @@ -0,0 +1,5 @@ + + + + + diff --git a/Game/Code/UnitTests/test_libraries.lpi b/Game/Code/UnitTests/test_libraries.lpi new file mode 100644 index 00000000..cc3a6ddf --- /dev/null +++ b/Game/Code/UnitTests/test_libraries.lpi @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UnitTests/test_libraries.lpi.bak b/Game/Code/UnitTests/test_libraries.lpi.bak new file mode 100644 index 00000000..aa876577 --- /dev/null +++ b/Game/Code/UnitTests/test_libraries.lpi.bak @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UnitTests/test_libraries.lpr b/Game/Code/UnitTests/test_libraries.lpr new file mode 100644 index 00000000..3e3ae380 --- /dev/null +++ b/Game/Code/UnitTests/test_libraries.lpr @@ -0,0 +1,31 @@ +program Test_Libraries; + +{$mode objfpc}{$H+} + +uses + Classes, + consoletestrunner, + TestSQLLite, + SQLite3 in '../lib/SQLite/SQLite3.pas', + + SQLiteTable3 in '../lib/SQLite/SQLiteTable3.pas'; + +type + + { TLazTestRunner } + + TMyTestRunner = class(TTestRunner) + protected + // override the protected methods of TTestRunner to customize its behavior + end; + +var + Application: TMyTestRunner; + +begin + Application := TMyTestRunner.Create(nil); + Application.Initialize; + Application.Title := 'FPCUnit Console test runner'; + Application.Run; + Application.Free; +end. diff --git a/Game/Code/UnitTests/testsqllite.pas b/Game/Code/UnitTests/testsqllite.pas new file mode 100644 index 00000000..b1b682d2 --- /dev/null +++ b/Game/Code/UnitTests/testsqllite.pas @@ -0,0 +1,84 @@ +unit TestSQLLite; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, testutils, testregistry, SQLiteTable3, unix; + +type + + TTest_SqlLite= class(TTestCase) + private + fSQLLite : TSQLiteDatabase; + fFileName : string; + protected + procedure SetUp; override; + procedure TearDown; override; + published + procedure Test_Random_TableExists; + procedure Test_Delete_NonExistant_Table; + procedure Test_TableExists_On_0Length_File; + end; + +implementation + +procedure TTest_SqlLite.Test_Random_TableExists; +begin + deletefile( fFileName ); + fSQLLite := TSQLiteDatabase.Create( fFileName ); + + // Test if some random table exists + check( not fSQLLite.TableExists( 'testTable'+floattostr(now()) ) , 'Randomly Named Table Should NOT Exists (In an empty database file)' ); +end; + +procedure TTest_SqlLite.Test_Delete_NonExistant_Table; +var + lSQL : String; +begin + deletefile( fFileName ); + fSQLLite := TSQLiteDatabase.Create( fFileName ); + try + lSQL := 'DROP TABLE testtable'; + fSQLLite.execsql( lSQL ); + except + exit; + end; + + Fail('SQLLite did not except when trying to delete a non existant table' ); +end; + +procedure TTest_SqlLite.Test_TableExists_On_0Length_File; +var + lSQL : String; +begin + deletefile( fFileName ); + shell('cat /dev/null > '+fFileName); + + if not fileexists( fFileName ) then + Fail('0 Length file was not created... oops' ); + + fSQLLite := TSQLiteDatabase.Create( fFileName ); + + check( not fSQLLite.TableExists( 'testTable' ) , 'Randomly Named Table Should NOT Exists' ); +end; + + +procedure TTest_SqlLite.SetUp; +begin + fFileName := 'test.db'; +// fSQLLite := TSQLiteDatabase.Create( fFileName ); +end; + + +procedure TTest_SqlLite.TearDown; +begin + freeandnil( fSQLLite ); +end; + +initialization + + RegisterTest(TTest_SqlLite); +end. + diff --git a/Game/Code/UnitTests/testsqllite.ppu b/Game/Code/UnitTests/testsqllite.ppu new file mode 100644 index 00000000..be4403f6 Binary files /dev/null and b/Game/Code/UnitTests/testsqllite.ppu differ diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst index 857993e7..3ecbe3f1 100644 --- a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst @@ -1,26 +1,26 @@ - -# hash value = 79191886 -opengl12.srcalreadyactive='Rendering context already active in another th'+ -'read.' - - -# hash value = 191308692 -opengl12.smakecurrentfailed='wglMakeCurrent failed' - - -# hash value = 214729876 -opengl12.sdeletecontextfailed='wglDeleteContext failed' - - -# hash value = 230190814 -opengl12.scontextinuse='Cannot delete rendering context. It is still in u'+ -'se by another thread.' - - -# hash value = 168003996 -opengl12.sdefaultgllibrary='OpenGL32.dll' - - -# hash value = 140838716 -opengl12.sdefaultglulibrary='GLU32.dll' - + +# hash value = 79191886 +opengl12.srcalreadyactive='Rendering context already active in another th'+ +'read.' + + +# hash value = 191308692 +opengl12.smakecurrentfailed='wglMakeCurrent failed' + + +# hash value = 214729876 +opengl12.sdeletecontextfailed='wglDeleteContext failed' + + +# hash value = 230190814 +opengl12.scontextinuse='Cannot delete rendering context. It is still in u'+ +'se by another thread.' + + +# hash value = 258732735 +opengl12.sdefaultgllibrary='libGL.so' + + +# hash value = 113317743 +opengl12.sdefaultglulibrary='libGLU.so' + -- cgit v1.2.3