math-optim/algo/algo_test.go
surtur babbd4201e
All checks were successful
continuous-integration/drone/push Build is passing
go: fix DoRandomSearch unit test
the test was previously failing due to a folder not present when results
were to be saved.
2022-06-28 23:42:15 +02:00

39 lines
552 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"
)
var wg sync.WaitGroup
func TestDoRandomSearchExec(t *testing.T) {
wg.Add(1)
go DoRandomSearch(&wg)
wg.Wait()
if err := os.RemoveAll(picPath); err != nil {
t.Error(err)
}
}
func TestDoSHCExec(t *testing.T) {
wg.Add(1)
go DoStochasticHillClimbing(&wg)
wg.Wait()
}
func TestNewValues(t *testing.T) {
if v := newValues(); v == nil {
t.Error("failed to get values from newValues()")
}
}