package sampleAnalyses_test


import "seekia/internal/genetics/sampleAnalyses"

import "seekia/internal/genetics/geneticReferences/monogenicDiseases"
import "seekia/internal/genetics/geneticReferences/polygenicDiseases"
import "seekia/internal/genetics/geneticReferences/traits"
import "seekia/internal/genetics/readGeneticAnalysis"

import "testing"


func TestPersonSampleAnalyses(t *testing.T){

	monogenicDiseases.InitializeMonogenicDiseaseVariables()

	err := polygenicDiseases.InitializePolygenicDiseaseVariables()	
	if (err != nil) {
		t.Fatal("InitializePolygenicDiseaseVariables failed: " + err.Error())
	}

	err = traits.InitializeTraitVariables()
	if (err != nil) {
		t.Fatal("InitializeTraitVariables failed: " + err.Error())
	}

	person1AnalysisObject, err := sampleAnalyses.GetSamplePerson1Analysis()
	if (err != nil) {
		t.Fatal("GetSamplePerson1Analysis failed: " + err.Error())
	}

	person2AnalysisObject, err := sampleAnalyses.GetSamplePerson2Analysis()
	if (err != nil){
		t.Fatal("GetSamplePerson2Analysis failed: " + err.Error())
	}

	err = readGeneticAnalysis.VerifyPersonGeneticAnalysis(person1AnalysisObject)
	if (err != nil) {
		t.Fatal("SamplePerson1 genetic analysis is malformed: " + err.Error())
	}

	err = readGeneticAnalysis.VerifyPersonGeneticAnalysis(person2AnalysisObject)
	if (err != nil) {
		t.Fatal("SamplePerson2 genetic analysis is malformed: " + err.Error())
	}	
}


func TestCoupleSampleAnalyses(t *testing.T){

	monogenicDiseases.InitializeMonogenicDiseaseVariables()

	err := polygenicDiseases.InitializePolygenicDiseaseVariables()	
	if (err != nil) {
		t.Fatal("InitializePolygenicDiseaseVariables failed: " + err.Error())
	}

	err = traits.InitializeTraitVariables()
	if (err != nil) {
		t.Fatal("InitializeTraitVariables failed: " + err.Error())
	}

	coupleAnalysisObject, err := sampleAnalyses.GetSampleCoupleAnalysis()
	if (err != nil){
		t.Fatal("GetSampleCoupleAnalysis failed: " + err.Error())
	}

	err = readGeneticAnalysis.VerifyCoupleGeneticAnalysis(coupleAnalysisObject)
	if (err != nil) {
		t.Fatal("Sample couple genetic analysis is malformed: " + err.Error())
	}
}


