YAC 3.18.0
Yet Another Coupler
Loading...
Searching...
No Matches
test_version.F90
Go to the documentation of this file.
1! Copyright (c) 2024 The YAC Authors
2!
3! SPDX-License-Identifier: BSD-3-Clause
4
8
9#include "yac_config.h"
10#include "yac_version_check.h"
11
12#include "test_macros.inc"
13
15
16 use utest
17 use yac, only : yac_fget_version
18
19 implicit none
20
21 character(len=1024) :: macro_version
22 character(len=:), allocatable :: function_version
23 logical :: yac_version_is_greater_equal
24
25 call start_test("yac_version")
26
27 allocate(character(32) :: function_version)
28 function_version = yac_fget_version()
29
30 call test(allocated(function_version))
31
32 if (allocated(function_version)) then
33 write(macro_version, '(A,I0,A,I0,A,I0,A)') &
34 "v", yac_version_major, ".", &
35 yac_version_minor, ".", &
36 yac_version_patch, &
37 yac_version_tweak
38 call test(trim(macro_version) == trim(function_version))
39
40 write(macro_version, '(A,A)') "v", yac_version
41 call test(trim(macro_version) == trim(function_version))
42
43 print *, 'YAC Version: ' // trim(function_version)
44 end if
45
46# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR-1, YAC_VERSION_MINOR, YAC_VERSION_PATCH)
47 yac_version_is_greater_equal = .true.
48# else
49 yac_version_is_greater_equal = .false.
50# endif
51 call test(yac_version_is_greater_equal)
52
53# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR, YAC_VERSION_MINOR-1, YAC_VERSION_PATCH)
54 yac_version_is_greater_equal = .true.
55# else
56 yac_version_is_greater_equal = .false.
57# endif
58 call test(yac_version_is_greater_equal)
59
60# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR, YAC_VERSION_MINOR, YAC_VERSION_PATCH-1)
61 yac_version_is_greater_equal = .true.
62# else
63 yac_version_is_greater_equal = .false.
64# endif
65 call test(yac_version_is_greater_equal)
66
67# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR, YAC_VERSION_MINOR, YAC_VERSION_PATCH)
68 yac_version_is_greater_equal = .true.
69# else
70 yac_version_is_greater_equal = .false.
71# endif
72 call test(yac_version_is_greater_equal)
73
74# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR, YAC_VERSION_MINOR, YAC_VERSION_PATCH+1)
75 yac_version_is_greater_equal = .true.
76# else
77 yac_version_is_greater_equal = .false.
78# endif
79 call test(.NOT. yac_version_is_greater_equal)
80
81# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR, YAC_VERSION_MINOR+1, YAC_VERSION_PATCH)
82 yac_version_is_greater_equal = .true.
83# else
84 yac_version_is_greater_equal = .false.
85# endif
86 call test(.NOT. yac_version_is_greater_equal)
87
88# if YAC_VERSION_GREATER_EQUAL(YAC_VERSION_MAJOR+1, YAC_VERSION_MINOR, YAC_VERSION_PATCH)
89 yac_version_is_greater_equal = .true.
90# else
91 yac_version_is_greater_equal = .false.
92# endif
93 call test(.NOT. yac_version_is_greater_equal)
94
95 call stop_test
96
97 call exit_tests
98
99end program test_version
100
Fortran interface for getting the YAC version.
Definition utest.F90:5
subroutine, public start_test(name)
Definition utest.F90:20
subroutine, public stop_test()
Definition utest.F90:27
subroutine, public exit_tests()
Definition utest.F90:81
program test_version