diff --git a/ackwork/ackwork_test.go b/ackwork/ackwork_test.go
index a02d2231878cbbb999b1e5acbb44c9b038bedd58..36826be6d95c47c2aa20319c12b21facd972ea17 100644
--- a/ackwork/ackwork_test.go
+++ b/ackwork/ackwork_test.go
@@ -64,7 +64,7 @@ ini_temp 0.5
final_temp 0.05
x_ini 7,1,7
n_step 100000
-fOutName testreal`
+fOutName ""`
// These values seem to work well. There is something of a phase
// transition near temperature 0.09. Good values for an optimisation
@@ -128,7 +128,7 @@ func TestPlot(t *testing.T) {
}
}
-func TestSetSuffix (t *testing.T) {
+func TestSetSuffix(t *testing.T) {
var tdata = []struct {
in, suffix, want string
}{
@@ -144,24 +144,47 @@ func TestSetSuffix (t *testing.T) {
}
for _, s := range tdata {
- if tmp, err := SetSuffix (s.in, s.suffix); err != nil {
- t.Fatal ("setSuffix error handling", s)
+ if tmp, err := SetSuffix(s.in, s.suffix); err != nil {
+ t.Fatal("setSuffix error handling", s)
} else {
if tmp != s.want {
- t.Fatal ("Wanted", s.want, "got", tmp, "working on", s)
+ t.Fatal("Wanted", s.want, "got", tmp, "working on", s)
}
}
}
}
+func TestRemoveQuotes(t *testing.T) {
+ var tdata = []struct {
+ in, out string
+ } {
+ {"hello", "hello"},
+ {"", ""},
+ {`"`, ""},
+ {`""`, ""},
+ {`"""`, ""},
+ {`""a"`, "a"},
+ {`""aa"`, "aa"},
+ {`""a""`, "a"},
+ {`"a"`, "a"},
+ {`a"`, "a"},
+ {`a""`, "a"},
+ }
+ for _, ss := range tdata {
+ if out := RemoveQuotes (ss.in); out != ss.out {
+ t.Fatalf ("Wanted <%s>, got <%s>. Input was <%s>", ss.out, out, ss.in)
+ }
+ }
+}
+
// Check that errors are generated
-func TestSetSuffixErr (t *testing.T) {
- var tdata = []struct {in, suffix string}{
+func TestSetSuffixErr(t *testing.T) {
+ var tdata = []struct{ in, suffix string }{
{"", ""},
- {".", ""} }
+ {".", ""}}
for _, s := range tdata {
- if _, err := SetSuffix (s.in, s.suffix); err == nil {
- t.Fatal ("setSuffix should return error on", s)
+ if _, err := SetSuffix(s.in, s.suffix); err == nil {
+ t.Fatal("setSuffix should return error on", s)
}
}
}
diff --git a/ackwork/dorun.go b/ackwork/dorun.go
index 9bae7669b15d4eb6c3a962bfb6dfb31ecba643b3..ad540e92f6d2f1b7757d02f83f4af93f28f49eff 100644
--- a/ackwork/dorun.go
+++ b/ackwork/dorun.go
@@ -204,7 +204,6 @@ func doRun(mcPrm *mcPrm) error {
}
newx(x, xT, cprm.rand, xDlta)
fTrial = ackley.Ackley(xT)
-
if fTrial <= fOld {
accept = true
} else {