#! /bin/bash

echo Generating dataset
../Generator 10000 100 > mix

echo Creating new R-Tree and Querying
../RTreeLoad mix tree 20 intersection > res

echo Running exhaustive search
../Exhaustive mix intersection > res2

echo Comparing results
sort -n res > a
sort -n res2 > b
if diff a b
then
echo "Same results with exhaustive search. Everything seems fine."
echo Results: `wc -l a`
rm -rf a b res res2 tree.*
else
echo "PROBLEM! We got different results from exhaustive search!"
fi

