Skip to content

Commit 73ec8d2

Browse files
committed
test patches
1 parent af8be83 commit 73ec8d2

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

src/clustering/abstraction.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ impl std::fmt::Display for Abstraction {
174174
impl Arbitrary for Abstraction {
175175
fn random() -> Self {
176176
use rand::Rng;
177-
let street = Street::random();
178-
let n = street.k();
179-
let i = rand::thread_rng().gen_range(0..n);
177+
let street = Street::Flop;
178+
let k = street.k();
179+
let i = rand::thread_rng().gen_range(0..k);
180180
Abstraction::from((street, i))
181181
}
182182
}

src/clustering/metric.rs

+11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ impl Metric {
5151
/// entreis in our abstraction pair lookup table.
5252
/// if this is off by just a few then it probably means a bunch of collisions
5353
/// maybe i should determinsitcally seed kmeans process, could be cool for reproducability too
54+
///
55+
/// TODO
56+
///
57+
/// determine street dynamiccaly by checking for existence of XOR'ed abstraction pairs using
58+
/// Abstraction::From(Street, Index)
59+
///
60+
/// it's also not great that we are FORCED to have different number of abstractions
61+
/// clusters K means for each street to avoid nC2 collisions !!
62+
/// we should either just store Street as Self.1 or determine from XOR hits what street we're on
63+
/// whichever solution should work with test case so we don't have to remove test case
64+
/// to not overwrite existing metric. we like overwriting river.metric bc it can be empty
5465
fn street(&self) -> Street {
5566
fn choose_2(k: usize) -> usize {
5667
k * (k.saturating_sub(1)) / 2

src/mccfr/path.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl Arbitrary for Path {
1515
/// we (un)pack the byte representation of the edges in a Path(u64) sequence
1616
impl From<Path> for Vec<Edge> {
1717
fn from(path: Path) -> Self {
18-
(0..)
18+
(0..16)
1919
.map(|i| i * 4)
2020
.map(|b| 0xF & (path.0 >> b))
2121
.map(|bits| bits as u8)
@@ -69,18 +69,17 @@ mod tests {
6969
#[test]
7070
fn bijective_path_empty() {
7171
let edges = vec![];
72-
let round = Vec::<Edge>::from(Path::from(edges.clone()));
73-
assert_eq!(edges, round);
72+
let paths = Vec::<Edge>::from(Path::from(edges.clone()));
73+
assert_eq!(edges, paths);
7474
}
7575

7676
#[test]
7777
fn bijective_path_edges() {
7878
let edges = (0..)
7979
.map(|_| Edge::random())
80-
.filter(|e| e.is_choice())
8180
.take(16)
8281
.collect::<Vec<Edge>>();
83-
let round = Vec::<Edge>::from(Path::from(edges.clone()));
84-
assert_eq!(edges, round);
82+
let paths = Vec::<Edge>::from(Path::from(edges.clone()));
83+
assert_eq!(edges, paths);
8584
}
8685
}

src/mccfr/profile.rs

+6
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ impl std::fmt::Display for Profile {
568568
)
569569
}
570570
}
571+
571572
#[cfg(test)]
572573
mod tests {
573574
use super::*;
@@ -576,6 +577,11 @@ mod tests {
576577
use crate::Save;
577578

578579
#[test]
580+
#[ignore]
581+
/// we don't run this test because we don't want to overwrite
582+
/// an existing blueprint profile, and we no longer use any
583+
/// arguments to the save function to write to a temporary name
584+
/// and delete the file
579585
fn persistence() {
580586
let name = "test";
581587
let file = format!("{}.profile.pgcopy", name);

0 commit comments

Comments
 (0)