program conditionalLoopTesting
! fortran conditionals and loop testing harness
! All tests should pass

print*,"Testing variable logic and storage\n"

! Testing conditional statements if and if else 
print*,"Testing conditionals (8 tests should be displayed)"

if (5==5) then
print*,"Conditional test one: passed"
end if

if (5/=6) then
print*,"Conditional test two: passed"
end if

if(5.5==5.5) then
print*,"Conditional test three: passed"
end if

if(5.5/=6.6) then
print*,"Conditional test four: passed"
end if

if (5==6) then
print*,"Conditional test five: failed"
else
print*,"Conditional test five: passed"
end if

if (5/=5) then
print*,"Conditional six: failed"
else
print*,"Conditional six: passed"
end if

if(5.5==6.6) then
print*,"Conditional test seven: failed"
else
print*,"Conditional seven: passed"
end if

if(5.5/=5.5) then
print*,"Conditional test eight: failed"
else
print*,"Conditional test eight: passed"
end if


! These tests output as expected, so we can simplify further logical tests

print*,"\n\nTesting logic: (five tests should pass)"
if(6==6 .and. 5==5) then
print*,"Logical test one: passed"
end if

if(6==5 .and. 5==5) then
print*,"Logical test two: failed"
else
print*,"Logical test two: passed"
end if

if(6==6 .and. 5==6) then
print*,"Logical test three: failed"
else
print*,"Logical test three: passed"
end if


if(6==5 .or. 5==5) then
print*,"Logical test four: passed"
end if

if(6==5 .or. 5==6) then
print*,"Logical test five: failed"
else
print*,"Logical test five: passed"
end if


print*,"\n\nTesting looping (2 loops 1 to 10 should display)"
print*,"Looping from 1 to 10 using do statement (for loop equivalent)"
int::i
do i=0,10
print*,i
end do

print*,"\nLooping from 1 to 10 using do while statement (while loop equivalent)"
i=0
do while(i<=10)
print*,i
i=i+1
end do

end program conditionalLoopTesting