MCPcopy Create free account
hub / github.com/dds-bridge/dds / TEST

Function TEST

library/tests/heuristic_sorting/targeted_unit_tests.cpp:17–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15// Targeted unit tests for small helper functions and golden expectations
16
17TEST(TargetedUnitTests, RankForcesAceBasic) {
18 // Construct a minimal context and exercise rank_forces_ace for different cards4th
19 Pos tpos = {};
20 memset(&tpos, 0, sizeof(tpos));
21
22 // Build a safe HeuristicContext using local objects
23 MoveType bm = {};
24 MoveType bmtt = {};
25 RelRanksType thrp_rel_dummy[1] = {};
26 MoveType mply_dummy[1] = {};
27 TrackType track_dummy = {};
28
29 HeuristicContext ctx = {
30 tpos, // Pos
31 bm, // bestMove
32 bmtt, // bestMoveTT
33 thrp_rel_dummy, // thrp_rel
34 mply_dummy, // mply
35 0, // numMoves
36 0, // lastNumMoves
37 DDS_NOTRUMP, // trump
38 0, // suit
39 &track_dummy, // trackp
40 0, // currTrick
41 0, // currHand
42 0, // leadHand
43 0 // leadSuit
44 };
45
46 // Sanity: ensure function is callable and returns in-range values
47 int res0 = rank_forces_ace(ctx, 0);
48 int res1 = rank_forces_ace(ctx, 1);
49 int res5 = rank_forces_ace(ctx, 5);
50
51 // rank_forces_ace may return -1 when no forcing rank exists; ensure value is sane
52 EXPECT_GE(res0, -1);
53 EXPECT_GE(res1, -1);
54 EXPECT_GE(res5, -1);
55 EXPECT_LE(res0, 14);
56 EXPECT_LE(res1, 14);
57 EXPECT_LE(res5, 14);
58}
59
60TEST(TargetedUnitTests, GetTopNumberEdgeCases) {
61 Pos tpos = {};

Callers

nothing calls this directly

Calls 2

rank_forces_aceFunction · 0.85
get_top_numberFunction · 0.85

Tested by

no test coverage detected