package geodist_test

import "testing"

import "seekia/imported/geodist"

func TestDistanceCalculations(t *testing.T){

	// distance New York to San Diego: 3915340.577 m
	// distance El Paso to Saint Louis: 1663833.491 m

	newYorkLatitude := 40.7128
	newYorkLongitude := 74.0060

	sanDiegoLatitude := 32.7157
	sanDiegoLongitude := 117.1611

	elPasoLatitude := 31.7619
	elPasoLongitude := 106.4850

	stLouisLatitude := 38.6270
	stLouisLongitude := 90.1994

	kilometers, err := geodist.GetDistanceBetweenCoordinates(newYorkLatitude, newYorkLongitude, sanDiegoLatitude, sanDiegoLongitude)
	if (err != nil){
		t.Fatal("Cannot compute distance between coordinates: " + err.Error())
	}

	if (int(kilometers) != 3911){
		t.Fatal("Distance is invalid between New York and San Diego")
	}

	kilometers, err = geodist.GetDistanceBetweenCoordinates(elPasoLatitude, elPasoLongitude, stLouisLatitude, stLouisLongitude)
	if (err != nil){
		t.Fatal("Cannot compute distance between coordinates: " + err.Error())
	}

	if (int(kilometers) != 1663){
		t.Fatal("Distance is invalid between El Paso and St. Louis")
	}

}


