URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 154 |
Rev 816 |
! Program to test the LEN and LEN_TRIM intrinsics.
|
! Program to test the LEN and LEN_TRIM intrinsics.
|
subroutine test (c)
|
subroutine test (c)
|
character(*) c
|
character(*) c
|
character(len(c)) d
|
character(len(c)) d
|
|
|
d = c
|
d = c
|
if (len(d) .ne. 20) call abort
|
if (len(d) .ne. 20) call abort
|
if (d .ne. "Longer Test String") call abort
|
if (d .ne. "Longer Test String") call abort
|
c = "Hello World"
|
c = "Hello World"
|
end subroutine
|
end subroutine
|
|
|
subroutine test2 (c)
|
subroutine test2 (c)
|
character (*) c
|
character (*) c
|
character(len(c)) d
|
character(len(c)) d
|
|
|
d = c
|
d = c
|
if (len(d) .ne. 6) call abort
|
if (len(d) .ne. 6) call abort
|
if (d .ne. "Foobar") call abort
|
if (d .ne. "Foobar") call abort
|
end subroutine
|
end subroutine
|
|
|
program strlen
|
program strlen
|
implicit none
|
implicit none
|
character(20) c
|
character(20) c
|
character(5) a, b
|
character(5) a, b
|
integer i
|
integer i
|
|
|
c = "Longer Test String"
|
c = "Longer Test String"
|
call test (c)
|
call test (c)
|
|
|
if (len(c) .ne. 20) call abort
|
if (len(c) .ne. 20) call abort
|
if (len_trim(c) .ne. 11) call abort
|
if (len_trim(c) .ne. 11) call abort
|
|
|
call test2 ("Foobar");
|
call test2 ("Foobar");
|
end program
|
end program
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.