Wirkt nur mit RAKE_LIVE-Scope (rake::live::active), Absprache rake-live: Leiter RAKE_LIVE gegen RAKE_LIVE+PREFLOP_MIKRO. Leere Dateien (chartgen --mikro laeuft in der Warteschlange) lassen die alte Tabelle stehen. Aus: bit-identisch (tests/preflop_mikro.rs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.1 KiB
Rust
58 lines
2.1 KiB
Rust
//! Spec: `PREFLOP_MIKRO` reads the live micro tables (no antes, micro rake) ONLY inside a raked cash
|
|
//! spot (`rake::live` scope). Off, or without a scope (tournaments, `RAKE_LIVE` off): bit-identical.
|
|
//! A table not yet solved (empty file) leaves the old one in place.
|
|
//!
|
|
//! The switch is process-global: everything that toggles it runs in ONE test, in order.
|
|
|
|
use rechner::cfr::hand_class::class_parse;
|
|
use rechner::cfr::seat::Seat;
|
|
use rechner::preflop::generated_charts::OPEN;
|
|
use rechner::preflop::generated_charts_mikro::{OPEN as OPEN_MIKRO, PUSH_FOLD as PUSH_MIKRO};
|
|
use rechner::preflop::generated_lookup::{open_frequency, push_frequency};
|
|
use rechner::preflop::mikro::{mikro, set_mikro};
|
|
use rechner::rake::live::Scope;
|
|
use rechner::variant::Variant;
|
|
|
|
#[test]
|
|
fn the_micro_tables_apply_only_with_the_switch_and_a_raked_cash_spot() {
|
|
let k4o = class_parse("K4o").expect("K4o");
|
|
let read = || {
|
|
OPEN.iter()
|
|
.map(|s| open_frequency(Variant::Nlhe, s.seat, s.depth_bb as f64, k4o).expect("open").raise)
|
|
.chain([push_frequency(Variant::Nlhe, Seat::Button, 10.0, k4o).expect("push").raise])
|
|
.collect::<Vec<f64>>()
|
|
};
|
|
set_mikro(false);
|
|
let base = read();
|
|
|
|
// Switch on, no scope (tournament / RAKE_LIVE off): nothing changes.
|
|
set_mikro(true);
|
|
assert!(!mikro());
|
|
assert_eq!(read(), base);
|
|
|
|
// Switch off, scope on: nothing changes.
|
|
set_mikro(false);
|
|
{
|
|
let _s = Scope::enter(0.02);
|
|
assert!(!mikro());
|
|
assert_eq!(read(), base);
|
|
}
|
|
|
|
// Both: the micro tables where solved, the old ones where the file is still empty.
|
|
set_mikro(true);
|
|
{
|
|
let _s = Scope::enter(0.02);
|
|
assert!(mikro());
|
|
let on = read();
|
|
if OPEN_MIKRO.is_empty() && PUSH_MIKRO.is_empty() {
|
|
assert_eq!(on, base, "unsolved: the old tables stay");
|
|
} else if !OPEN_MIKRO.is_empty() {
|
|
for (i, s) in OPEN_MIKRO.iter().enumerate() {
|
|
assert!((on[i] - s.open[k4o] as f64 / 1000.0).abs() < 1e-12);
|
|
}
|
|
}
|
|
}
|
|
assert!(!mikro(), "scope dropped");
|
|
set_mikro(false);
|
|
}
|