tstLinking.f90

./Manager/wrap/tests/tstLinking.f90

1 program tstlinking
3 
4 #include "ScaleSTL/FortranTestMacros.h"
5 
6 !Add dynamic path info for ARP library
7 use origen_testpaths_m
8 !
9 use nemesis_comm, only: build_types, initialize, finalize, node
10 
11 implicit none
12 
13 type(origen_librarywrapper) :: libw1,libw2
14 
15 call initialize
16 call build_types
17 if( node() /= 0 ) call finalize
18 
19 call libw1%initialize(w14_e15_filepath)
20 
21 !set to position 1 and check burnup
22 call libw1%set_pos(1)
23 expect_eq(0.0,libw1%get_burnup())
24 expect_eq(1,libw1%get_pos())
25 expect_eq(1,libw1%ref_count())
26 
27 !set to position 2 and check burnup
28 call libw1%set_pos(2)
29 expect_eq(1040.0,libw1%get_burnup())
30 expect_eq(2,libw1%get_pos())
31 expect_eq(1,libw1%ref_count())
32 
33 !now use assignment operation and show they point to same
34 libw2=libw1
35 !check reference counts
36 expect_eq(2,libw1%ref_count())
37 expect_eq(2,libw2%ref_count())
38 !check burnups
39 expect_eq(1040.0,libw1%get_burnup())
40 expect_eq(1040.0,libw2%get_burnup())
41 !check positions
42 expect_eq(2,libw1%get_pos())
43 expect_eq(2,libw2%get_pos())
44 
45 !but if you change libw2, will it change libw1?
46 call libw2%set_pos(3)
47 !check burnups
48 expect_eq(1040.0,libw1%get_burnup())
49 expect_eq(3000.0,libw2%get_burnup())
50 !check positions
51 expect_eq(2,libw1%get_pos())
52 expect_eq(3,libw2%get_pos())
53 
54 call libw1%destroy()
55 
56 expect_eq(3,libw2%get_pos())
57 expect_eq(1,libw2%ref_count())
58 call libw2%destroy()
59 
60 call finalize
61 
62 end program