File: applicationfactory-test.cpp

package info (click to toggle)
packagesearch 2.7.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,244 kB
  • sloc: cpp: 12,412; perl: 282; makefile: 69; sh: 13
file content (64 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// C++ Implementation: applicationfactory-test
//
// Description: 
//
//
// Author: Benjamin Mesing <bensmail@gmx.net>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifdef __UNIT_TEST_PP

#include <UnitTest++.h>


#include "applicationfactory.h"

#include "runcommand.h"

using namespace NApplication;


SUITE(ApplicationFactory_Test)
{
	
	// Equivalence classes:
	// GI1 getInstance() without it being called before
	// GI2 getInstance() after it was called before
	// SI1 setInstance()
	// GR getRunCommand
	
	TEST(getInstance)
	{
		// GI1
		ApplicationFactory* pFac1 = ApplicationFactory::getInstance();
		CHECK(pFac1 != 0);
		// GR
		pFac1->getRunCommand("test");	// everything should be fine here
		// GI2
		ApplicationFactory* pFac2 = ApplicationFactory::getInstance();
		CHECK_EQUAL(pFac1, pFac2);
	}

// 	TEST(setInstance)
// 	{
		// untested
// 	}
	
	TEST(getRunCommand)
	{
		ApplicationFactory* pFac1 = ApplicationFactory::getInstance();
		// GR
		RunCommand* pR = pFac1->getRunCommand("test");	// everything should be fine here
		CHECK(pR != 0);		
		// cleanup
		delete pR;
	}


}

#endif	// __UNIT_TEST_PP