math-optim/run_test.go
leo cf61dd4795
All checks were successful
continuous-integration/drone/push Build is passing
run.go: add a way to profile program's mem usage
to prevent defer-after-exit, rework the way run() is done:
* make run return an error
* return nil if all went well
* return err if something went south

special-case ErrNoAlgoSelected in main().

adjust run_test.go to these new realities, also.
2023-02-24 15:37:59 +01:00

35 lines
603 B
Go

// Copyright 2023 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: GPL-3.0-or-later
package main
import (
"flag"
"testing"
)
func TestRun(t *testing.T) {
t.Log("call run() (TODO: improve this test)")
timeout := "1m10s"
t.Log("set test timeout to", timeout)
if err := flag.Set("test.timeout", timeout); err != nil {
t.Errorf("failed to set timeout to %s", timeout)
}
if err := flag.Set("c2jde", "false"); err != nil {
t.Errorf("failed to not run jDE: %q", err)
}
err := run()
if err != nil {
if err.Error() == "ErrNoAlgoSelected" {
return
}
t.Error(err)
}
}