@@ -2,7 +2,10 @@ use crate::solutions::Solution;
22use crate :: utils:: point3d:: Point3D ;
33use itertools:: Itertools ;
44
5+ #[ cfg( not( test) ) ]
56const INPUT_CONNECTIONS : usize = 1_000 ;
7+ #[ cfg( test) ]
8+ const TEST_CONNECTIONS : usize = 10 ;
69
710type Pair = ( Point3D , Point3D ) ;
811
@@ -104,6 +107,7 @@ impl Day08 {
104107 }
105108}
106109
110+ #[ cfg( not( test) ) ]
107111impl Default for Day08 {
108112 fn default ( ) -> Self {
109113 Self {
@@ -112,21 +116,20 @@ impl Default for Day08 {
112116 }
113117}
114118
119+ #[ cfg( test) ]
120+ impl Default for Day08 {
121+ fn default ( ) -> Self {
122+ Self {
123+ connections : TEST_CONNECTIONS ,
124+ }
125+ }
126+ }
127+
115128#[ cfg( test) ]
116129mod tests {
117130 use crate :: solutions:: year2025:: day08:: Day08 ;
118131 use crate :: solutions:: Solution ;
119132
120- const TEST_CONNECTIONS : usize = 10 ;
121-
122- impl Day08 {
123- fn new_for_tests ( ) -> Self {
124- Self {
125- connections : TEST_CONNECTIONS ,
126- }
127- }
128- }
129-
130133 const EXAMPLE : & str = r#"162,817,812
13113457,618,57
132135906,360,560
@@ -150,11 +153,11 @@ mod tests {
150153
151154 #[ test]
152155 fn part_one_example_test ( ) {
153- assert_eq ! ( "40" , Day08 :: new_for_tests ( ) . part_one( EXAMPLE ) ) ;
156+ assert_eq ! ( "40" , Day08 :: default ( ) . part_one( EXAMPLE ) ) ;
154157 }
155158
156159 #[ test]
157160 fn part_two_example_test ( ) {
158- assert_eq ! ( "25272" , Day08 :: new_for_tests ( ) . part_two( EXAMPLE ) ) ;
161+ assert_eq ! ( "25272" , Day08 :: default ( ) . part_two( EXAMPLE ) ) ;
159162 }
160163}
0 commit comments