math-optim/bench/cec2020/inputData_test.go
leo 27a0c6dbe3
All checks were successful
continuous-integration/drone/push Build is passing
inputData: add shift data parsing
2023-02-15 13:20:21 +01:00

44 lines
835 B
Go

// Copyright 2023 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: GPL-3.0-or-later
package cec2020
import (
"testing"
)
func TestLoadInputData(t *testing.T) {
dim := 10
fnum := 1
m, s := LoadInputData(dim)
wantM := -0.6013070130189602
gotM := m[fnum][0][0]
// test matrix data.
if wantM != gotM {
t.Errorf("unexpected result, want: %v, got: %v", wantM, gotM)
}
wantM = 9.2845625214477390e-01
gotM = m[fnum][1][1]
if wantM != gotM {
t.Errorf("unexpected result, want: %v, got: %v", wantM, gotM)
}
// test shiftData.
wantS := -70.42955971808618
gotS := s[fnum][0][1]
if wantS != gotS {
t.Errorf("unexpected result, want: %v, got: %v", wantS, gotS)
}
wantS = 36.645777950364064
gotS = s[fnum][0][10]
if wantS != gotS {
t.Errorf("unexpected result, want: %v, got: %v", wantS, gotS)
}
}