TestCalcIndex and testLegendException pass, added badLegend.txt