source: trunk/source/geometry/volumes/test/testG4SmartVoxelProxy.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

File size: 3.4 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: testG4SmartVoxelProxy.cc,v 1.4 2006/06/29 18:58:50 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30
31// testG4SmartVoxelNodeProxy
32//             Ensure asserts are compiled in
33//
34// Test file for G4SmartVoxelProxy
35//
36// o Simplistic checks for
37//
38//   IsNode
39//   IsHeader
40//   GetNode
41//   GetHeader
42
43#include <assert.h>
44
45// Global defs
46#include "globals.hh"
47
48// Tested entities
49#include "G4SmartVoxelProxy.hh"
50
51// Required
52#include "G4SmartVoxelNode.hh"
53#include "G4SmartVoxelHeader.hh"
54#include "G4LogicalVolume.hh"
55#include "G4Box.hh"
56
57G4bool testG4SmartVoxelNodeProxy()
58{
59    G4SmartVoxelNode *tNode;
60    G4SmartVoxelProxy *tNodeProxy;
61    tNode=new G4SmartVoxelNode(1);
62    assert(tNode != 0);         // Sanity check
63    tNodeProxy=new G4SmartVoxelProxy(tNode);
64    assert(tNodeProxy != 0);            // Sanity check
65   
66    assert(tNodeProxy->IsNode());
67    assert(!tNodeProxy->IsHeader());
68    assert(tNodeProxy->GetNode()==tNode);
69    delete tNodeProxy;
70    delete tNode;
71    return true;
72}
73
74G4bool testG4SmartVoxelHeaderProxy()
75{
76    G4Box tBox("dummyBox",1,1,1);
77    G4LogicalVolume tVol(&tBox,0,"dummyLogical",0,0,0);
78
79    G4SmartVoxelHeader *tHeader;
80    G4SmartVoxelProxy *tHeaderProxy;
81    tHeader=new G4SmartVoxelHeader(&tVol);
82    assert(tHeader != 0);               // Sanity check
83    tHeaderProxy=new G4SmartVoxelProxy(tHeader);
84    assert(tHeaderProxy != 0);  // Sanity check
85   
86    assert(!tHeaderProxy->IsNode());
87    assert(tHeaderProxy->IsHeader());
88    assert(tHeaderProxy->GetHeader()==tHeader);
89    delete tHeaderProxy;
90    delete tHeader;
91    return true;
92}
93
94int main()
95{
96#ifdef NDEBUG
97    G4Exception("FAIL: *** Assertions must be compiled in! ***");
98#endif
99    assert(testG4SmartVoxelNodeProxy());
100    assert(testG4SmartVoxelHeaderProxy());
101    return 0;
102}
103
104
Note: See TracBrowser for help on using the repository browser.