49 lines
728 B
Go
49 lines
728 B
Go
// Copyright 2022 wanderer <a_mirre at utb dot cz>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package algo
|
|
|
|
import (
|
|
"os"
|
|
"sync"
|
|
"testing"
|
|
|
|
"git.dotya.ml/wanderer/math-optim/report"
|
|
)
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
func TestDoRandomSearchExec(t *testing.T) {
|
|
wg.Add(1)
|
|
|
|
go DoRandomSearch(&wg)
|
|
|
|
wg.Wait()
|
|
|
|
picsDir := report.GetPicsDir()
|
|
|
|
if err := os.RemoveAll(picsDir); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestDoSHCExec(t *testing.T) {
|
|
wg.Add(1)
|
|
|
|
go DoStochasticHillClimbing(&wg)
|
|
|
|
wg.Wait()
|
|
|
|
picsDir := report.GetPicsDir()
|
|
|
|
if err := os.RemoveAll(picsDir); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestNewValues(t *testing.T) {
|
|
if v := newValues(); v == nil {
|
|
t.Error("failed to get values from newValues()")
|
|
}
|
|
}
|