Phase 2: customers paying in coin (CRC/CRT/CRA/PSC), taint from stolen goods

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-03 16:01:20 +08:00
1 parent 1ba0652705
commit 090a973d23
10 files changed
+149

No files matched your search

@@ -488,6 +488,16 @@ internal static class Program
Check(Near(back.Market.Price, m.Price, 1e-9), "读回后继续推进,行情与原来完全相同");
});
Test("用币付款:派系对应的币、按币价换算、污点与成本", () =>
{
var w = new Wallet { Address = "t" };
Check(CoinPayment.AssetFor("FACTION_BLACK_MARKET") == Assets.CRT && CoinPayment.AssetFor("FACTION_SECURITY") == null, "派系对应的币");
double q = CoinPayment.Receive(w, Assets.CRT, 200, 0.5, 40);
Check(Near(q, 400, 1e-9) && Near(w.Get(Assets.CRT), 400, 1e-9), "按币价换算数量");
Check(Near(w.Taint, 80, 1e-9) && Near(w.Basis, 200, 1e-9), "污点 = 货值 × 热度%,成本 = 货值");
Check(CoinPayment.Receive(w, Assets.CRC, 0, 1, 10) == 0, "零金额不收");
});
Console.WriteLine($"\n{_passed} 通过,{_failed} 失败");
return _failed == 0 ? 0 : 1;
}