Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion golang/test/optimal_portfolio_scenario_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ func assertDecimalEqual(t *testing.T, label, got, want string) {
t.Fatalf("%s: invalid want value %q: %v", label, want, err)
}
if !g.Equal(w) {
t.Errorf("%s: got %s, want %s", label, got, want)
t.Fatalf("%s: got %s, want %s", label, got, want)
}
}
8 changes: 4 additions & 4 deletions patches/golang.patch
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ index 583d888..9d332e9 100644
+}
diff --git a/test/order_scenario_test.go b/test/order_scenario_test.go
new file mode 100644
index 0000000..de74563
index 0000000..2d461b0
--- /dev/null
+++ b/test/order_scenario_test.go
@@ -0,0 +1,168 @@
Expand Down Expand Up @@ -300,7 +300,7 @@ index 0000000..de74563
+ }
+ diff1 := total1.Sub(decimal.NewFromInt(100000)).Abs()
+ if diff1.GreaterThan(decimal.NewFromInt(2)) {
+ t.Errorf("asset1 total should be ~100000, got %s", total1.String())
+ t.Fatalf("asset1 total should be ~100000, got %s", total1.String())
+ }
+
+ asset1Toyopa := findStock(asset1.Stocks, "Toyopa")
Expand All @@ -326,7 +326,7 @@ index 0000000..de74563
+ }
+ diff2 := total2.Sub(decimal.NewFromInt(200000)).Abs()
+ if diff2.GreaterThan(decimal.NewFromInt(4)) {
+ t.Errorf("asset2 total should be ~200000, got %s", total2.String())
+ t.Fatalf("asset2 total should be ~200000, got %s", total2.String())
+ }
+
+ t.Log("現金比率5%に対して現金が 10,000円、最適ポートフォリオに基づき Toyopa の保有額が 76,000 円(40%)、Somy の保有額が 114,000 円(60%) となる")
Expand Down Expand Up @@ -363,7 +363,7 @@ index 0000000..de74563
+ }
+ diff3 := total3.Sub(total2).Abs()
+ if diff3.GreaterThan(decimal.NewFromInt(4)) {
+ t.Errorf("asset3 total should be ~%s (total2), got %s", total2.String(), total3.String())
+ t.Fatalf("asset3 total should be ~%s (total2), got %s", total2.String(), total3.String())
+ }
+
+ t.Log("現金比率5%に対して現金が 10,000円、最適ポートフォリオに基づき Toyopa の保有額が 19,000 円(10%)、Somy の保有額が 171,000 円(90%) となる")
Expand Down
Loading