#!/bin/csh

source $JPP_DIR/externals/ulib/ulib.csh

set_variable A a

insert_directory A b
insert_directory A bc
insert_directory A c
insert_directory A cd
insert_directory A d


set_variable     N    `echo $A | tr ':' '\n' | wc -l`

echo $A $N

if (( $N != 6 )) then
    echo "Wrong number of directories $N."; exit 1
endif


insert_directory A c

set_variable     N    `echo $A | tr ':' '\n' | wc -l`

echo $A $N

if (( $N != 6 )) then
    echo "Wrong number of directories $N."; exit 1
endif


remove_directory A c

set_variable     N    `echo $A | tr ':' '\n' | wc -l`

echo $A $N

if (( $N != 5 )) then
    echo "Wrong number of directories $N."; exit 1
endif

set_variable     N    `count_directory A b`

if (( $N != 1 )) then
    echo "Wrong number of directories b $N != 1."; exit 1
endif

set_variable     N    `count_directory A c`

if (( $N != 0 )) then
    echo "Wrong number of directories c $N != 0."; exit 1
endif

