test_save Subroutine

subroutine test_save()

Arguments

None

Contents

Source Code


Source Code

subroutine test_save ()
   call lala( 'display(ones(80,1)''*61)')
   call lala( 'help save')
   call lala( [ character(len=256) :: &
     & 'clear                                 // clear out user variables                                             ', &
     & 'A=magic(4); b=ones(3,4); c=12**2;     // define some variables                                                ', &
     & 'test_Variable=1234567890;                                                                                     ', &
     & 'save(''__saved'');                      // save user variables to a file                                        ', &
     & 'who; clear; who                       // list variables clear and they should be gone                         ', &
     & 'load(''__saved'')                       // load the variables back in                                           ', &
     & 'who                                   // should see them now                                                  ', &
     & 'tally=[0];                            // test they are expected values and sizes                              ', &
     & 'if A=magic(4),  tally=[tally,0];display(''save of A PASSED'');else,tally=[tally,1];display(''save of A FAILED''); ', &
     & 'if b=ones(3,4), tally=[tally,0];display(''save of b PASSED'');else,tally=[tally,1];display(''save of b FAILED''); ', &
     & 'if c=12**2,     tally=[tally,0];display(''save of c PASSED'');else,tally=[tally,1];display(''save of c FAILED''); ', &
     & 'if test_Variable=1234567890, ...                                                                              ', &
     & '   tally=[tally,0];...                                                                                        ', &
     & '   display(''save of test_variable PASSED'');...                                                                ', &
     & '   else,...                                                                                                   ', &
     & '   tally=[tally,1];...                                                                                        ', &
     & '   display(''save of test_variable FAILED'');                                                                   ', &
     & 'end;                                                                                                          ', &
     & 'if sum(tally)=0,display(''save PASSED'');else,display(''save FAILED'');tally                                      ', &
     & 'delete(''__saved'')                     // delete the scratch file                                              ', &
     & ''])
end subroutine test_save