go: fix DoRandomSearch unit test
All checks were successful
continuous-integration/drone/push Build is passing

the test was previously failing due to a folder not present when results
were to be saved.
This commit is contained in:
surtur 2022-06-28 23:42:15 +02:00
parent b24f7db46f
commit babbd4201e
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 11 additions and 4 deletions

@ -4,6 +4,7 @@
package algo package algo
import ( import (
"os"
"sync" "sync"
"testing" "testing"
) )
@ -11,13 +12,15 @@ import (
var wg sync.WaitGroup var wg sync.WaitGroup
func TestDoRandomSearchExec(t *testing.T) { func TestDoRandomSearchExec(t *testing.T) {
// TODO(me): figure out how to test this. wg.Add(1)
// wg.Add(1) go DoRandomSearch(&wg)
// go DoRandomSearch(&wg) wg.Wait()
// wg.Wait() if err := os.RemoveAll(picPath); err != nil {
t.Error(err)
}
} }
func TestDoSHCExec(t *testing.T) { func TestDoSHCExec(t *testing.T) {

@ -59,6 +59,10 @@ func plotAllDims(allStats []stats.Stats, fPrefix, fExt string) {
log.Fatal(err) log.Fatal(err)
} }
if err := createFolder(picPath); err != nil {
log.Println(err)
}
filename := picPath + filename := picPath +
fPrefix + "-" + fPrefix + "-" +
sanitiseFName(s.Algo) + "-" + sanitiseFName(s.Algo) + "-" +