source: trunk/oldtest/src/RpLibraryF_test.f @ 4635

Last change on this file since 4635 was 3177, checked in by mmc, 9 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File size: 5.4 KB
Line 
1c ----------------------------------------------------------------------
2c  TEST: Fortran Rappture Library Test Source.
3c
4c  Simple tests of the Rappture Library Fortran Bindings
5c
6c ======================================================================
7c  AUTHOR:  Derrick S. Kearney, Purdue University
8c  Copyright (c) 2004-2012  HUBzero Foundation, LLC
9c
10c  See the file "license.terms" for information on usage and
11c  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12c ======================================================================
13      SUBROUTINE  test_element(lib,path)
14        integer rp_lib_element_obj
15        integer retVal, lib
16        character*100 typ, comp, id, path
17
18        print *,"TESTING ELEMENT: path = ",path
19
20        retVal = rp_lib_element_obj(lib, path)
21
22        print *,"dict key = ",retVal
23
24        ! what happens when you get details for lib?
25        call rp_lib_node_comp(retVal,comp)
26        call rp_lib_node_type(retVal,typ)
27        call rp_lib_node_id(retVal,id)
28
29        print *,"comp = ",comp
30        print *,"type = ",typ
31        print *,"id = ",id
32      END SUBROUTINE  test_element
33
34      SUBROUTINE  test_get(lib,path)
35        integer lib
36        character*100 path, retText
37
38        print *,"TESTING GET       : path = ",path
39
40        call rp_lib_get(lib, path, retText)
41
42        print *,"retText = ",retText
43      END SUBROUTINE  test_get
44
45      SUBROUTINE  test_get_str(lib,path)
46        integer lib
47        character*100 path, retText
48
49        print *,"TESTING GET STRING: path = ",path
50
51        call rp_lib_get_str(lib, path, retText)
52
53        print *,"retText = ",retText
54      END SUBROUTINE  test_get_str
55
56      SUBROUTINE  test_get_dbl(lib,path)
57        integer lib
58        double precision rslt, rp_lib_get_double
59        character*100 path
60
61        print *,"TESTING GET DOUBLE: path = ",path
62
63        rslt = rp_lib_get_double(lib, path)
64
65        print *,"rslt = ",rslt
66      END SUBROUTINE  test_get_dbl
67
68      SUBROUTINE  test_get_int(lib,path)
69        integer lib
70        integer rslt, rp_lib_get_integer
71        character*100 path
72
73        print *,"TESTING GET INTEGER: path = ",path
74
75        rslt = rp_lib_get_integer(lib, path)
76
77        print *,"rslt = ",rslt
78      END SUBROUTINE  test_get_int
79
80      SUBROUTINE  test_get_bool(lib,path)
81        integer lib
82        integer rslt, rp_lib_get_boolean
83        character*100 path
84
85        print *,"TESTING GET BOOLEAN: path = ",path
86
87        rslt = rp_lib_get_boolean(lib, path)
88
89        print *,"rslt = ",rslt
90      END SUBROUTINE  test_get_bool
91
92      program rplib_f_tests
93        IMPLICIT NONE
94
95        integer rp_lib
96
97        integer driver
98        CHARACTER*100 inFile, path
99
100        call getarg(1,inFile)
101        driver = rp_lib(inFile)
102        ! print *,"dict key = ",driver
103
104        ! TESTING ELEMENT
105        path = "input.number(min)"
106        call test_element(driver, path)
107
108        ! TESTING GET
109        path = "input.number(min).current"
110        call test_get(driver, path)
111
112        ! TESTING GET STRING
113        path = "input.number(min).current"
114        call test_get_str(driver, path)
115
116        ! TESTING GET DOUBLE
117        path = "input.number(min).current"
118        call test_get_dbl(driver, path)
119
120        ! TESTING GET INT
121        path = "input.integer(try).current"
122        call rp_lib_put_str(driver, path, "12",0)
123        call test_get_int(driver, path)
124        call rp_lib_put_str(driver, path, "15.043",0)
125        call test_get_int(driver, path)
126
127        ! TESTING GET BOOLEAN
128        path = "input.boolean(b).current"
129        call rp_lib_put_str(driver, path, "true",0)
130        call test_get_bool(driver, path)
131        call rp_lib_put_str(driver, path, "false",0)
132        call test_get_bool(driver, path)
133        call rp_lib_put_str(driver, path, "1",0)
134        call test_get_bool(driver, path)
135        call rp_lib_put_str(driver, path, "0",0)
136        call test_get_bool(driver, path)
137        call rp_lib_put_str(driver, path, "on",0)
138        call test_get_bool(driver, path)
139        call rp_lib_put_str(driver, path, "off",0)
140        call test_get_bool(driver, path)
141        call rp_lib_put_str(driver, path, "yes",0)
142        call test_get_bool(driver, path)
143        call rp_lib_put_str(driver, path, "no",0)
144        call test_get_bool(driver, path)
145        call rp_lib_put_str(driver, path, "t",0)
146        call test_get_bool(driver, path)
147        call rp_lib_put_str(driver, path, "f",0)
148        call test_get_bool(driver, path)
149        call rp_lib_put_str(driver, path, "ye",0)
150        call test_get_bool(driver, path)
151        call rp_lib_put_str(driver, path, "n",0)
152        call test_get_bool(driver, path)
153        call rp_lib_put_str(driver, path, "tr",0)
154        call test_get_bool(driver, path)
155        call rp_lib_put_str(driver, path, "of",0)
156        call test_get_bool(driver, path)
157
158        call rp_result(driver)
159      end program rplib_f_tests
160
161!        call rp_lib_get(driver,
162!     +        "input.number(min).current", strVal)
163!        ok = rp_units_convert_dbl(strVal,"K",T)
164!
165!        call rp_lib_get(driver,
166!     +        "input.number(Ef).current", strVal)
167!        ok = rp_units_convert_dbl(strVal,"K",Ef)
168!
169!        kT = 8.61734e-5 * T
170!        Emin = Ef - 10*kT
171!        Emax = Ef + 10*kT
172!
173!        dE = 0.005*(Emax - Emin)
174!
175!        do 10 E=Emin,Emax,dE
176!          f = 1.0/(1.0+exp((E-Ef)/kT))
177!          write(xy,'(E20.12,F13.9,A)') f, E, char(10)
178!          call rp_lib_put_str(driver,
179!     +        "output.curve(f12).component.xy", xy, 1)
180! 10     continue
181!
182!      end program rplib_f_tests
Note: See TracBrowser for help on using the repository browser.