#!/usr/bin/perl -w
#  Test that it is possible to list directories in directories.

use gnump3d::files;

#
#  Create a clean subdirectory.
#
`rm -rf ./foo`;
`mkdir ./foo`;


#
#  Create two files in that directory, and
# some subdirectories.
#
`ls > ./foo/ls.txt`;
`ls > ./foo/ls2.txt`;
`mkdir ./foo/clair`;
`mkdir ./foo/sally`;
`mkdir ./foo/sara`;

#
#  Read the number of dirs
#
my @files = &dirsInDir("foo/");

#
#  Cleanup.
#
`rm -rf ./foo`;

#
# Did we get something at all?
if ( ! @files )
{
	exit 1;
}

#
#  Were there three directories there?  (0 based).
#
if ( $#files != 2 )
{
	exit 1;
}


#
# All OK
exit 0;