anchor.diff:  ! ******************************************************************
   ! ******************************************************************
   
  -  subroutine test_load_data
  +  subroutine test_load_ordered_containers
  +
  +    use packdat, only : loadData, nContainers, setCurrContainer, &
  +         cLength, cWidth, reset
  +
  +    use items, only : ItemType
  +
  +    use containers, only : Container, emptyContainer
  +
  +    implicit none
  +
  +    character(80) :: filename
  +
  +    integer :: i
  +
  +    real(8) :: prevCArea, currCArea
  +    
  +    integer :: qIt(1) = (/ 10 /)
  +
  +    type(ItemType) :: it(1)
  +
  +    type(Container) :: cont(3)
  +    
  +    call reset()
  +
  +    it(1) = ItemType(0, 0, 0.0D0, 0.0D0)
  +
  +    cont(1) = emptyContainer(1, 1.0D0, 1.0D0)
  +
  +    cont(2) = emptyContainer(2, 5.0D0, 5.0D0)
  +
  +    cont(3) = emptyContainer(3, 2.0D0, 2.0D0)
  +
  +    filename = "data.txt"
  +
  +    ! Test 1
  +    
  +    qIt = (/10/)
  +    
  +    call createFiles(it, 1, cont, 3, qIt)
  +    
  +    call loadData(filename)
  +
  +    call assert_equals(3, nContainers)
  +
  +    prevCArea = 0.0D0
  +    
  +    do i = 1, 3
  +
  +       call setCurrContainer(i)
  +       
  +       currCArea = cLength * cWidth
  +       
  +       call assert_true( prevCArea .le. currCArea, &
  +            "Unsorted containers." )
  +
  +       prevCArea = currCArea
  +
  +    end do    
  +
  +  end subroutine test_load_ordered_containers
  +  
  +! ******************************************************************
  +! ******************************************************************
  +
  +  subroutine test_load_data_single
   
       use packdat, only : loadData, nTItems, nItems, iLength, &
            iWidth, iId, nContainers, setCurrContainer, cLength, &
  -         cWidth, cId, shutdown
  +         cWidth, cId, reset
   
       use items, only : ItemType
   
  
positive.code: 
      filename = "data.txt"
  
      ! Test 1
      
      qIt = (/10, 0, 0, 0/)
      
      call createFiles(it, nit, cont, 1, qIt)
      
      call loadData(filename)
      
  
      call assert_equals(1, nContainers)
  
      call setCurrContainer(1)
  
      call assert_equals(cont(1)%length, cLength)
  
      call assert_equals(cont(1)%width, cWidth)
      
  
      totalIt = sum(qIt)
      
      call assert_equals(totalIt, nTItems)
  
      call assert_equals(nItems, nTItems)
  
      call assert_equals(totalIt, size(iLength))
  
      call assert_equals(totalIt, size(iWidth))
  
      call assert_equals(totalIt, size(iId))
      
      do i = 1, totalIt
  
         call assert_equals(it(1)%length, iLength(i))
  
         call assert_equals(it(1)%width, iWidth(i))
  
         call assert_equals(it(1)%class, iId(i))
  
      end do
  
      ! Test 2
  
      call shutdown()
      
      qIt = (/10, 0, 20, 30/)
      
      call createFiles(it, nit, cont, ncont, qIt)
      
      call loadData(filename)
  
  
      call assert_equals(ncont, nContainers)
  
      prevCArea = 0.0D0
      
      do i = 1, ncont
  
         call setCurrContainer(i)
         
         currCArea = cLength * cWidth
         
         call assert_true( prevCArea .le. currCArea )
  
         prevCArea = currCArea
  
      end do    
  
      totalIt = sum(qIt)
  
  
negative.code: 
         end do
  
         call assert_equals(qIt(i), countType, "Wrong number of items")
  
      end do
            
    end subroutine test_load_data_many
  
  end module packdat_test
  