Fortran · 1161 bytes Raw Blame History
1 program test_program
2 ! Test program using math_utils module
3 !
4 ! Test cross-file navigation:
5 ! - F12 on 'vector_add' should jump to math_utils.f90
6 ! - Shift+F12 on 'vector_dot' should show all usages
7 ! - Ctrl+Shift+T and search "vector" to find all vector functions
8
9 use math_utils
10 implicit none
11
12 integer, parameter :: n = 3
13 real :: a(n), b(n), result(n)
14 real :: dot_prod, mag
15 integer :: i
16
17 ! Initialize vectors
18 a = [1.0, 2.0, 3.0]
19 b = [4.0, 5.0, 6.0]
20
21 ! Test vector addition
22 ! F12 on vector_add should jump to math_utils.f90
23 call vector_add(a, b, result, n)
24
25 print *, 'Vector A:', a
26 print *, 'Vector B:', b
27 print *, 'A + B :', result
28
29 ! Test dot product
30 ! F12 on vector_dot should jump to definition
31 dot_prod = vector_dot(a, b, n)
32 print *, 'A · B :', dot_prod
33
34 ! Test magnitude
35 mag = vector_magnitude(a, n)
36 print *, '|A| :', mag
37
38 ! Intentional error - missing variable declaration
39 ! ERROR: 'undefined_result' is not declared
40 undefined_result = dot_prod * 2.0
41 print *, 'Result :', undefined_result
42
43 end program test_program
44