package goodcalc import ( "fmt" "testing" ) func emptyMatrix() *Matrix { m := Matrix{ MaxPoints: 1000, MaxValuationPoints: 10, MaxNegValuationPoints: -200, NegPointsFactor: 50, Stakeholders: []*Stakeholder{}, Calculation: &MatrixCalc{ SumCalcWeight: 0, WeightFactor: 0, }, } stakeholderDefault := []Stakeholder{ {"A", 1.5, []*Theme{}}, {"B", 0.5, []*Theme{}}, {"C", 0.5, []*Theme{}}, {"D", 1, []*Theme{}}, {"E", 1, []*Theme{}}, } themeDefault := []string{"1", "2", "3", "4"} for _, st := range stakeholderDefault { s := st for _, th := range themeDefault { t := Theme{ No: st.No + th, Weight: 1, Aspects: []Aspect{}, NegativeAspects: []NegativeAspect{}, negPointsFactor: 0, Calc: &ThemeCalc{}, } for i := 1; i <= 2; i++ { a := Aspect{ No: fmt.Sprintf("%s.%d", t.No, i), Weight: 1, ValuationPoints: 5, } t.Aspects = append(t.Aspects, a) } for i := 3; i <= 4; i++ { a := NegativeAspect{ Aspect{ No: fmt.Sprintf("%s.%d", t.No, i), Weight: 1, ValuationPoints: -10, }, } t.NegativeAspects = append(t.NegativeAspects, a) } s.Themes = append(s.Themes, &t) } m.Stakeholders = append(m.Stakeholders, &s) } return &m } func TestMatrix_BalancePoints(t *testing.T) { tests := []struct { name string m *Matrix want int }{ { "", emptyMatrix(), 100, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.m.BalancePoints(); got != tt.want { t.Errorf("Matrix.BalancePoints() = %v, want %v", got, tt.want) } //fmt.Printf("%s", tt.m) }) } }