Vendor runtime behavior fixtures
- SHA
df345ac0734a9b19f7ea0f60718a66f97910e192- Parents
-
02b7911 - Tree
ba2bc70
df345ac
df345ac0734a9b19f7ea0f60718a66f97910e19202b7911
ba2bc70| Status | File | + | - |
|---|---|---|---|
| M |
fixtures/README.md
|
3 | 1 |
| A |
fixtures/runtime/derived_type_basic.f90
|
20 | 0 |
| A |
fixtures/runtime/mixed_types.f90
|
10 | 0 |
| A |
fixtures/runtime/string_fixed.f90
|
13 | 0 |
| A |
fixtures/runtime/where_construct.f90
|
27 | 0 |
fixtures/README.mdmodified@@ -20,4 +20,6 @@ generation, and Mach-O snapshot assertions. | |||
| 20 | Sprint 6 begins carving stable runtime programs into `fixtures/runtime/` so | 20 | Sprint 6 begins carving stable runtime programs into `fixtures/runtime/` so |
| 21 | targeted suites can stop depending on the surrounding parent repo layout. | 21 | targeted suites can stop depending on the surrounding parent repo layout. |
| 22 | The `runtime-completion`, `runtime-control-flow`, and `runtime-stateful` | 22 | The `runtime-completion`, `runtime-control-flow`, and `runtime-stateful` |
| 23 | -families now live there as bench-owned inputs. | 23 | +families now live there as bench-owned inputs, along with the |
| 24 | +`runtime-behavior` slice (`mixed_types`, `where_construct`, | ||
| 25 | +`derived_type_basic`, and `string_fixed`). | ||
fixtures/runtime/derived_type_basic.f90added@@ -0,0 +1,20 @@ | |||
| 1 | +! Basic derived type test: define type, declare variable, assign components, read back. | ||
| 2 | +! | ||
| 3 | +! CHECK: 42 | ||
| 4 | +! CHECK: 3.14 | ||
| 5 | +program test_derived_type | ||
| 6 | + implicit none | ||
| 7 | + | ||
| 8 | + type :: point | ||
| 9 | + integer :: id | ||
| 10 | + real :: x | ||
| 11 | + end type | ||
| 12 | + | ||
| 13 | + type(point) :: p | ||
| 14 | + | ||
| 15 | + p%id = 42 | ||
| 16 | + p%x = 3.14 | ||
| 17 | + | ||
| 18 | + print *, p%id | ||
| 19 | + print *, p%x | ||
| 20 | +end program | ||
fixtures/runtime/mixed_types.f90added@@ -0,0 +1,10 @@ | |||
| 1 | +! CHECK: 5.5 | ||
| 2 | +program mixed_types | ||
| 3 | + implicit none | ||
| 4 | + integer :: a | ||
| 5 | + real :: b, c | ||
| 6 | + a = 3 | ||
| 7 | + b = 2.5 | ||
| 8 | + c = a + b | ||
| 9 | + print *, c | ||
| 10 | +end program | ||
fixtures/runtime/string_fixed.f90added@@ -0,0 +1,13 @@ | |||
| 1 | +! CHECK: Fortran | ||
| 2 | +! CHECK: Hi | ||
| 3 | +program test_string_fixed | ||
| 4 | + implicit none | ||
| 5 | + character(10) :: greeting | ||
| 6 | + character(5) :: short | ||
| 7 | + | ||
| 8 | + greeting = 'Fortran' | ||
| 9 | + print *, greeting | ||
| 10 | + | ||
| 11 | + short = 'Hi there, world' | ||
| 12 | + print *, short | ||
| 13 | +end program | ||
fixtures/runtime/where_construct.f90added@@ -0,0 +1,27 @@ | |||
| 1 | +! WHERE construct with expression mask and multi-array body. | ||
| 2 | +! Tests element-wise evaluation of mask and body. | ||
| 3 | +! | ||
| 4 | +! CHECK: 0 | ||
| 5 | +! CHECK: 0 | ||
| 6 | +! CHECK: 3 | ||
| 7 | +! CHECK: 4 | ||
| 8 | +! CHECK: 5 | ||
| 9 | +program test_where | ||
| 10 | + implicit none | ||
| 11 | + integer, allocatable :: a(:), b(:) | ||
| 12 | + integer :: i | ||
| 13 | + allocate(a(5), b(5)) | ||
| 14 | + do i = 1, 5 | ||
| 15 | + a(i) = i | ||
| 16 | + b(i) = 0 | ||
| 17 | + end do | ||
| 18 | + where (a > 2) | ||
| 19 | + b = a | ||
| 20 | + end where | ||
| 21 | + print *, b(1) | ||
| 22 | + print *, b(2) | ||
| 23 | + print *, b(3) | ||
| 24 | + print *, b(4) | ||
| 25 | + print *, b(5) | ||
| 26 | + deallocate(a, b) | ||
| 27 | +end program | ||