File: CoinErrorTest.cpp

package info (click to toggle)
coinutils 2.11.4%2Brepack1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,212 kB
  • sloc: cpp: 73,714; sh: 11,224; makefile: 276; ansic: 35
file content (54 lines) | stat: -rw-r--r-- 1,168 bytes parent folder | download | duplicates (14)
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
// Copyright (C) 2000, International Business Machines
// Corporation and others.  All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).

#ifdef NDEBUG
#undef NDEBUG
#endif

#include <cassert>
#include "CoinError.hpp"

void
CoinErrorUnitTest()
{

  // Test default constructor
  {
    CoinError r;
    assert( r.message_=="" );
    assert( r.method_=="" );
    assert( r.class_=="" );
  }

  // Test alternate constructor and get method
  CoinError rhs;
  {
    CoinError a("msg","me.hpp","cl");
    assert( a.message()=="msg" );
    assert( a.methodName()=="me.hpp" );
    assert( a.className()=="cl" );
    
    // Test copy constructor
    {
      CoinError c(a);
      assert( c.message()=="msg" );
      assert( c.methodName()=="me.hpp" );
      assert( c.className()=="cl" );
    }
    
    // Test assignment
    {
      CoinError a1("msg1","meth1","cl1");
      assert( a1.message()=="msg1" );
      assert( a1.methodName()=="meth1" );
      assert( a1.className()=="cl1" );
      rhs = a1;
    }
  }
  assert( rhs.message()=="msg1" );
  assert( rhs.methodName()=="meth1" );
  assert( rhs.className()=="cl1" );


}