#!/bin/csh

# CSC 468
# Winter 2009
# Project Stage 3

# test script #2  for "unit-testing" your XPLite implementation

# note: not all features can be unit-tested.
# For example, implementations of built-in functions will
# can be unit-tested only if we validate at least one non-trivial
# axis 

# So, really, this is a test script for differential testing of your XPLite 
# implementation

#21. predicates, functions, not(), text()
echo "document(\"eureka\")/descendant::genre[not(text()=\"Drama\")]"
java XpathPlus RETURN document("eureka")/descendant::genre[not(self::node[text()="Drama"])]

#22. predicates, functions, not(), true(), boolean equality
echo "document(\"eureka\")/descendant::genre[not(text()=\"Drama\")=true()]"
java XpathPlus RETURN document("eureka")/descendant::genre[not(self:node[text()="Drama"])= true()]

#23. predicates, functions, not(), false(), boolean equality
echo "document(\"eureka\")/descendant::genre[not(self::node()[text()=\"Drama\"])=false()]"
java XpathPlus RETURN document("eureka")/descendant::genre[not(self::node[text()="Drama"])= false()]

#24. predicates, functions, position, operations, equality
echo "document(\"eureka\")/descendant::episode[position() = 3]/child::title"
java XpathPlus RETURN document("eureka")/descendant::episode[position() = 3]/child::title

#25. predicates, functions, position, operations, inequality
echo "document(\"eureka\")/descendant::episode[position() <> 3]/child::title"
java XpathPlus RETURN document("eureka")/descendant::episode[position() <> 3]/child::title


#26. predicates, functions, position, operations, less than
echo "document(\"eureka\")/descendant::episode[position() < 3]/child::title"
java XpathPlus RETURN document("eureka")/descendant::episode[position() < 3]/child::title


#27. predicates, functions, position, operations, less than or equal to
echo "document(\"eureka\")/descendant::episode[position() <= 3]/child::title"
java XpathPlus RETURN document("eureka")/descendant::episode[position() <= 3]/child::title



#28. predicates, functions, position, operations, greater than
echo "document(\"eureka\")/descendant::episode[position() > 3]/child::title"
java XpathPlus RETURN document("eureka")/descendant::episode[position() > 3]/child::title

#29. predicates, functions, position, operations, greater than or equal to
echo "document(\"eureka\")/descendant::episode[position() >= 3]/child::title"
java XpathPlus RETURN document("eureka")/descendant::episode[position() >= 3]/child::title

#30. predicates, multiple nesting
echo "document(\"eureka\")/child::node()[self::node()[self::node()[self::node()[self::node()[self::rating]]]]]"

java XpathPlus RETURN document("eureka")/child::node()[self::node()[self::node()[self::node()[self::node()[self::rating]]]]]

#31. predicates, multiple predicates
echo " document(\"eureka\")/descendant::node()[self::name][position() < 5][position() > 2][not(parent::writers)]"

java XpathPlus RETURN document("eureka")/descendant::node()[self::name][position() < 5][position() > 2][not(parent::writers)]

#32. predicates.
# this should return writers.
echo "document(\"eureka\")/descendant::node()[not(parent::actors)]/self::node()/[self::name][position() < 5][position() > 2]"

java XpathPlus RETURN document("eureka")/descendant::node()[not(parent::actors)]/self::node()/[self::name][position() < 5][position() > 2]


#33. attribute axis: all attributes
echo "document(\"present\")/child::artist/attribute::node()"
java XpathPlus RETURN document("present")/child::artist/attribute::node()

#34.  attribute axis, node name test
echo "document(\"present\")/child::artist/attribute::name"
java XpathPlus RETURN document("present")/child::artist/attribute::name

#35. attribute axis, text() function
echo "document(\"present\")/child::artist/attribute::name"
java XpathPlus RETURN document("present")/child::artist/attribute::name[text()="Guy Evans"]

#36. attribute axis, parent axis.
echo "document(\"present\")/child::artist/attribute::name[text()=\"Guy Evans\"]/parent::*/attribute::type"
java XpathPlus RETURN document("present")/child::artist/attribute::name[text()="Guy Evans"]/parent::*/attribute::type

#37. attribute axis
echo "document(\"present\")/descendant::track[attribute::name[text()=\"Nutter Alert\"]"
java XpathPlus RETURN document("present")/descendant::track[attribute::name[text()="Nutter Alert"]

#38. attribute axis
# nodes with no attributes
echo "document(\"present\")/descendant::node[not(attribute::node())]"
java XpathPlus RETURN document("present")/descendant::node[not(attribute::node())]

#39. attribute axis
echo "document(\"present\")/descendant::track[attribute::number[text()=1]]/attribute::name"
java XpathPlus RETURN document("present")/descendant::track[attribute::number[text()=1]]/attribute::name

#40. attribute axis

echo "document(\"present\")/descendant::node()/attribute::node()"
java XpathPlus RETURN document("present")/descendant::node()/attribute::node()



#
#  please edit the lines of the script to make sure that your program will run
#
#  e.g., replace java XpathPlus with  java -cp .:neustore.jar  


# list all repositories, make certain things are fine
java XpathPlus  LIST













#
# AND WE ARE DONE!
#























