00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <spl/Debug.h>
00018 #include <spl/data/Connection.h>
00019
00020 #ifdef DEBUG
00021
00022 #include <spl/Log.h>
00023
00024 static void _TestCommand1()
00025 {
00026 Command *cmd = new Command("text");
00027 UNIT_ASSERT("command text", cmd->CommandTextGet().Equals("text"));
00028 DEBUG_CLEAR_MEM_CHECK_POINTS();
00029 DEBUG_NOTE_MEM(cmd);
00030 cmd->CheckMem();
00031 DEBUG_DUMP_MEM_LEAKS();
00032 UNIT_ASSERT_MEM_NOTED("Command 1.2");
00033
00034 delete cmd;
00035 DEBUG_CLEAR_MEM_CHECK_POINTS();
00036 DEBUG_DUMP_MEM_LEAKS();
00037 UNIT_ASSERT_MEM_NOTED("Command 1.2");
00038 Log::SWriteOkFail( "Command 1" );
00039 }
00040
00041 static void _TestCommand2()
00042 {
00043 Command *cmd = new Command("text");
00044 cmd->CreateParameter("c1", 1);
00045 UNIT_ASSERT("prm count", cmd->ParameterCount() == 1);
00046
00047 UNIT_ASSERT("command text", cmd->CommandTextGet().Equals("text"));
00048 DEBUG_CLEAR_MEM_CHECK_POINTS();
00049 DEBUG_NOTE_MEM(cmd);
00050 cmd->CheckMem();
00051 DEBUG_DUMP_MEM_LEAKS();
00052 UNIT_ASSERT_MEM_NOTED("Command 2.1");
00053
00054 UNIT_ASSERT("c1==1", cmd->GetParameter("c1")->GetInt32() == 1 );
00055 UNIT_ASSERT("prm count", cmd->ParameterCount() == 1);
00056
00057 delete cmd;
00058 DEBUG_CLEAR_MEM_CHECK_POINTS();
00059 DEBUG_DUMP_MEM_LEAKS();
00060 UNIT_ASSERT_MEM_NOTED("Command 2.2");
00061 Log::SWriteOkFail( "Command 2" );
00062 }
00063
00064 void _TestCommand()
00065 {
00066 _TestCommand1();
00067 DEBUG_CLEAR_MEM_CHECK_POINTS();
00068 DEBUG_DUMP_MEM_LEAKS();
00069
00070 _TestCommand2();
00071 DEBUG_CLEAR_MEM_CHECK_POINTS();
00072 DEBUG_DUMP_MEM_LEAKS();
00073 }
00074
00075 #endif