#!/bin/sh
#******************************************************************************
#
#   Copyright (c) International Business Machines  Corp., 2001
#
#   This program is free software;  you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
#   the GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this pronram;  if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
#
#  FILE   : size01
#
#  PURPOSE: To test the basic functionality of `size`.
#
#  HISTORY:
#    06/01 Robbie Williamson (robbiew@us.ibm.com)
#      -Ported
#
#
#-----------------------------------------------------------------------
#Uncomment line below for debug output.
#trace_logic=${trace_logic:-"set -x"}
$trace_logic

TCsrc=${TCsrc:-`pwd`}
TCtmp=${TCtmp:-/tmp/size01-$$}

do_setup()
{
  SIZE=/usr/bin/size
  mkdir $TCtmp
  $SIZE $TCsrc/test > $TCtmp/er_size
  $SIZE -V $TCsrc/test > $TCtmp/er_size_V
  $SIZE -o $TCsrc/test > $TCtmp/er_size_o
  $SIZE -x $TCsrc/test > $TCtmp/er_size_x
}


do_test()
{
#ASSERTION POSIX NEXT_AVAILABLE C
#
#size
#
#CODE

size $TCsrc/test > $TCtmp/ar_size

diff -bw  $TCtmp/ar_size  $TCtmp/er_size

if [ $? -eq 0 ]
	then
		echo  "size "
	else
		echo "FAIL - size "
		exit 1
fi

rm -f $TCtmp/*r_size


##ASSERTION POSIX NEXT_AVAILABLE C
#
#-V
#
#CODE

size -V $TCsrc/test > $TCtmp/ar_size_V

diff -bw  $TCtmp/ar_size_V $TCtmp/er_size_V

if [ $? -eq 0 ]
	then
		echo  "size -V"
	else
		echo "FAIL - size -V"
		exit 1
fi

rm -f $TCtmp/*r_size_V


##ASSERTION POSIX NEXT_AVAILABLE C
#
#-o
#
#CODE

size -o $TCsrc/test > $TCtmp/ar_size_o

diff -bw  $TCtmp/ar_size_o $TCtmp/er_size_o

if [ $? -eq 0 ]
	then
		echo  "size -o"
	else
		echo "FAIL - size -o"
		PASS=0
		exit 1
fi

rm -f $TCtmp/*r_size_o


##ASSERTION POSIX NEXT_AVAILABLE C
#
#-x
#
#CODE

size -x $TCsrc/test > $TCtmp/ar_size_x

diff -bw  $TCtmp/ar_size_x $TCtmp/er_size_x

if [ $? -eq 0 ]
	then
		echo  "size -x"
	else
		echo "FAIL - size -x"
		exit 1
fi

rm -rf $TCtmp

echo "Test Result: PASS"
exit 0
}

do_setup
do_test
