c**********************************************************************c
c  Description: Tests the initialization of the library. Specifically
c               tests usage of SAVE and DATA statements and the use
c               of and COMMON blocks.
c
c  Author:      J. Czechowski IV
c  Version:     $Id: test_init.for,v 1.1 2007/11/28 18:31:47 jxc Exp $
c**********************************************************************c
        program TEST_INIT
          implicit none
          include 'primitive.inc'
          include 'assert.inc'

          call M$CHECKIN

          call ASSERT_AUTOINIT('DEBUG','STAT')

          call M$SYNC

          call TEST_SAVE(1)
          call TEST_SAVE(2)
          call TEST_SAVE(3)

          call TEST_DATA(1)
          call TEST_DATA(2)
          call TEST_DATA(3)

          call TEST_COMMON1(1)
          call TEST_COMMON1(2)
          call TEST_COMMON2(3)
          call TEST_COMMON2(4)
          call TEST_COMMON1(5)
          call TEST_COMMON1(6)
          call TEST_COMMON2(7)
          call TEST_COMMON2(8)

          call M$RETURN
          call ASSERT_AUTOREPORT()
        end
        
        subroutine TEST_SAVE(try)
          include 'primitive.inc'
          integer*4    try
          integer*4    val
          character*32 str
          integer*4    lstr
          save val

          val  = val + 1
          lstr = m$l2a(val, str)
          call ASSERT('Trying test_save val='//str(1:lstr),
     &                (val .eq. try))
        end
        
        subroutine TEST_DATA(try)
          include 'primitive.inc'
          integer*4    try
          integer*4    val
          character*32 str
          integer*4    lstr
          data val /0/

          val  = val + 1
          lstr = m$l2a(val, str)
          call ASSERT('Trying test_data val='//str(1:lstr),
     &                (val .eq. try))
        end
        
        subroutine TEST_COMMON1(try)
          include 'primitive.inc'
          integer*4    try
          integer*4    val
          character*32 str
          integer*4    lstr
          common /COMMON_VAL/ val

          val  = val + 1
          lstr = m$l2a(val, str)
          call ASSERT('Trying test_common1 val='//str(1:lstr),
     &                (val .eq. try))
        end

        subroutine TEST_COMMON2(try)
          include 'primitive.inc'
          integer*4    try
          integer*4    val
          character*32 str
          integer*4    lstr
          common /COMMON_VAL/ val

          val  = val + 1
          lstr = m$l2a(val, str)
          call ASSERT('Trying test_common2 val='//str(1:lstr),
     &                (val .eq. try))
        end

c**********************************************************************c
c       Include assertion facility.
c**********************************************************************c
        include 'assert.for'
