Skip to content

Commit 729b403

Browse files
committed
fix demo to pass all tests
1 parent 7fd1ac9 commit 729b403

21 files changed

+30
-32
lines changed

test/example/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
macro(ADD_DEMO name)
22
add_executable(demo_${name} demo_${name}.f90)
33
target_link_libraries(demo_${name} "${PROJECT_NAME}")
4-
# add_test(NAME ${name}
5-
# COMMAND $<TARGET_FILE:demo_${name}> ${CMAKE_CURRENT_BINARY_DIR}
6-
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
4+
add_test(NAME ${name}
5+
COMMAND $<TARGET_FILE:demo_${name}> ${CMAKE_CURRENT_BINARY_DIR}
6+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
77
endmacro(ADD_DEMO)
88

99
add_subdirectory(array)

test/example/error/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
ADD_DEMO(check1)
2+
set_tests_properties(check1 PROPERTIES WILL_FAIL true)
23
ADD_DEMO(check2)
4+
set_tests_properties(check2 PROPERTIES WILL_FAIL true)
35
ADD_DEMO(check3)
46
ADD_DEMO(check4)
7+
set_tests_properties(check4 PROPERTIES SKIP_RETURN_CODE 77)
58
ADD_DEMO(error_stop1)
9+
set_tests_properties(error_stop1 PROPERTIES WILL_FAIL true)
610
ADD_DEMO(error_stop2)
11+
set_tests_properties(error_stop2 PROPERTIES WILL_FAIL true)

test/example/hash_procedures/demo_universal_mult_hash_64.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ program demo_universal_mult_hash_64
44
use iso_fortran_env, only: int64
55
implicit none
66
integer, allocatable :: array1(:)
7-
integer(int64) :: hash, i, seed, source
7+
integer(int64) :: hash, seed, source
88
seed = 0
99
allocate (array1(0:2**6 - 1))
1010
array1 = 0

test/example/hashmaps/demo_hashmaps_free_other.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ program demo_free_other
77
integer(int8) :: value(15)
88
end type dummy_type
99
type(dummy_type) :: dummy_val
10-
type(other_type), allocatable :: other_in, other_out
10+
type(other_type) :: other_in, other_out
1111
integer(int8) :: i
1212
do i = 1, 15
1313
dummy_val%value(i) = i

test/example/hashmaps/demo_hashmaps_get_other_data.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ program demo_get_other_data
22
use stdlib_kinds, only: int8
33
use stdlib_hashmaps, only: chaining_hashmap_type, int_index
44
use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set, get
5-
logical :: conflict, exists
5+
logical :: conflict
66
type(key_type) :: key
77
type(other_type) :: other
88
type(chaining_hashmap_type) :: map

test/example/hashmaps/demo_hashmaps_probes.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
program demo_probes
2-
use stdlib_hashmaps, only: chaining_hashmap_type, int_index
2+
use stdlib_hashmaps, only: chaining_hashmap_type
33
use stdlib_hashmap_wrappers, only: fnv_1_hasher
44
implicit none
55
type(chaining_hashmap_type) :: map
6-
real :: nprobes
6+
integer :: nprobes
77
call map%init(fnv_1_hasher)
88
nprobes = map%map_probes()
99
print *, "Initial probes = ", nprobes

test/example/io/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ADD_DEMO(fmt_constants)
2-
ADD_DEMO(getline)
2+
#ADD_DEMO(getline)
33
ADD_DEMO(loadnpy)
44
ADD_DEMO(loadtxt)
55
ADD_DEMO(open)

test/example/linalg/demo_diag2.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ program demo_diag2
33
implicit none
44
real, allocatable :: v(:)
55
real, allocatable :: A(:, :)
6-
integer :: i
76
v = [1, 2, 3, 4, 5]
87
A = diag(v) ! creates a 5 by 5 matrix with elements of v on the diagonal
98
end program demo_diag2

test/example/linalg/demo_diag3.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ program demo_diag3
44
integer, parameter :: n = 10
55
real :: c(n), ul(n - 1)
66
real :: A(n, n)
7-
integer :: i
87
c = 2
98
ul = -1
109
A = diag(ul, -1) + diag(c) + diag(ul, 1) ! Gil Strang's favorite matrix

test/example/linalg/demo_diag4.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ program demo_diag4
44
integer, parameter :: n = 12
55
real :: A(n, n)
66
real :: v(n)
7-
integer :: i
87
call random_number(A)
98
v = diag(A) ! v contains diagonal elements of A
109
end program demo_diag4

0 commit comments

Comments
 (0)