func TestOneLevelGroup(t *testing.T) {
	program := data.Program{}
	program.AcademicProgram.ProgramId = "Test"
	program.AcademicProgram.Description = sql.NullString{String: "Test Program", Valid: true}
	program.ProgramGroups = generateGroups(1, 1)
	out, err := Convert(program)
	if err != nil {
		t.Error(err)
	}

	if len(out.Requirements) != 1 {
		t.Log(fmt.Sprintf("Wrong number of requirements! %d != 1\n", len(out.Requirements)))
		t.Fail()
	}

	if len(out.Requirements[0].Requirements) != 0 {
		t.Log(fmt.Sprintf("Wrong number of child requirements! %d != 0\n", len(out.Requirements[0].Requirements)))
		t.Fail()
	}

	if len(out.Requirements[0].Specifications) != 0 {
		t.Log(fmt.Sprintf("Wrong number of child specifications! %d != 0\n", len(out.Requirements[0].Specifications)))
		t.Fail()
	}

	json, err := json.MarshalIndent(out, "", "    ")
	if err != nil {
		t.Error(err)
	}
	t.Log(string(json))
}
func TestTextOnly(t *testing.T) {
	program := data.Program{}
	program.AcademicProgram.ProgramId = "Test"
	program.AcademicProgram.Description = sql.NullString{String: "Test Program", Valid: true}
	program.ProgramTexts = []model.ProgramText{
		{
			ProgramId:         "Test",
			ParentGroupNumber: 0,
			SequenceNumber:    1,
			GroupText:         "TEST TEXT",
			Description:       "Test Description",
		},
	}

	out, err := Convert(program)
	if err != nil {
		t.Error(err)
	}

	j, err := json.MarshalIndent(out, "", "    ")
	if err != nil {
		t.Error(err)
	}
	t.Log(string(j))

	if len(out.Notes) != 1 {
		t.Log(fmt.Sprintf("Wrong number of Notes! %d != 1\n", len(out.Notes)))
		t.Fail()
	}
}
func TestGroupWithClass(t *testing.T) {
	program := data.Program{}
	program.AcademicProgram.ProgramId = "Test"
	program.AcademicProgram.Description = sql.NullString{String: "Test Program", Valid: true}
	program.ClassGroups = generateGroups(1, 1)
	program.ClassGroups[0].GroupRequirementType = "CLASS"
	program.ProgramClasses = []model.ProgramClass{
		{
			ProgramId:         "Test",
			ParentGroupNumber: 1,
			SequenceNumber:    2,
			CourseName:        sql.NullString{String: "Test Class", Valid: true},
			CurriculumId:      "12345",
			TitleCode:         sql.NullString{String: "", Valid: false},
			TitleCodeRequired: false,
		},
	}

	out, err := Convert(program)
	if err != nil {
		t.Error(err)
	}

	j, err := json.MarshalIndent(out, "", "    ")
	if err != nil {
		t.Error(err)
	}
	t.Log(string(j))

	if len(out.Requirements) != 1 {
		t.Log(fmt.Sprintf("Wrong number of child Requirements! %d != 1\n", len(out.Requirements)))
		t.Fail()
	}

	if len(out.Requirements[0].Requirements) != 1 {
		t.Log(fmt.Sprintf("Wrong number of (grand)child requirements! %d != 1\n", len(out.Requirements[0].Requirements)))
		t.Fail()
	}

	if len(out.Requirements[0].Requirements[0].Specifications) != 1 {
		t.Log(fmt.Sprintf("Wrong number of (great-grand)child specifications! %d != 1\n", len(out.Requirements[0].Requirements[0].Specifications)))
		t.Fail()
	}
}
func TestGroupWithText(t *testing.T) {
	program := data.Program{}
	program.AcademicProgram.ProgramId = "Test"
	program.AcademicProgram.Description = sql.NullString{String: "Test Program", Valid: true}
	program.ProgramGroups = generateGroups(1, 1)
	program.ProgramTexts = []model.ProgramText{
		{
			ProgramId:         "Test",
			ParentGroupNumber: 1,
			SequenceNumber:    2,
			GroupText:         "TEST TEXT",
			Description:       "Test Description",
		},
	}

	out, err := Convert(program)
	if err != nil {
		t.Error(err)
	}

	j, err := json.MarshalIndent(out, "", "    ")
	if err != nil {
		t.Error(err)
	}
	t.Log(string(j))

	if len(out.Requirements) != 1 {
		t.Log(fmt.Sprintf("Wrong number of child Requirements! %d != 1\n", len(out.Requirements)))
		t.Fail()
	}

	if len(out.Notes) != 0 {
		t.Log(fmt.Sprintf("Wrong number of notes! %d != 0\n", len(out.Notes)))
		t.Fail()
	}

	if len(out.Requirements[0].Notes) != 1 {
		t.Log(fmt.Sprintf("Wrong number of (grand)child notes! %d != 1\n", len(out.Requirements[0].Notes)))
		t.Fail()
	}
}