~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/examples/qt/ExampleTestCase.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "ExampleTestCase.h"
 
2
 
 
3
CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase );
 
4
 
 
5
void ExampleTestCase::example ()
 
6
{
 
7
   CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05);
 
8
   CPPUNIT_ASSERT (1 == 0);
 
9
   CPPUNIT_ASSERT (1 == 1);
 
10
}
 
11
 
 
12
 
 
13
void ExampleTestCase::anotherExample ()
 
14
{
 
15
   CPPUNIT_ASSERT (1 == 2);
 
16
}
 
17
 
 
18
void ExampleTestCase::setUp ()
 
19
{
 
20
   m_value1 = 2.0;
 
21
   m_value2 = 3.0;
 
22
}
 
23
 
 
24
void ExampleTestCase::testAdd ()
 
25
{
 
26
   double result = m_value1 + m_value2;
 
27
   CPPUNIT_ASSERT (result == 6.0);
 
28
}
 
29
 
 
30
 
 
31
void ExampleTestCase::testDivideByZero ()
 
32
{
 
33
   int  zero    = 0;
 
34
   int result   = 8 / zero;
 
35
}
 
36
 
 
37
 
 
38
void ExampleTestCase::testEquals ()
 
39
{
 
40
   std::auto_ptr<long>  l1 (new long (12));
 
41
   std::auto_ptr<long>  l2 (new long (12));
 
42
   
 
43
   CPPUNIT_ASSERT_EQUAL (12, 12);
 
44
   CPPUNIT_ASSERT_EQUAL (12L, 12L);
 
45
   CPPUNIT_ASSERT_EQUAL (*l1, *l2);
 
46
   
 
47
   CPPUNIT_ASSERT (12L == 12L);
 
48
   CPPUNIT_ASSERT_EQUAL (12, 13);
 
49
   CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, 11.99, 0.5);
 
50
}