262 p.get_total_points(), |
262 p.get_total_points(), |
263 p.get_rows_busted()); |
263 p.get_rows_busted()); |
264 } |
264 } |
265 } |
265 } |
266 |
266 |
|
267 // Tests. Try `cargo test`. |
|
268 // They have criminally low coverage, mostly due to the simplicity of the code. |
|
269 // Take it as some examples. |
267 #[cfg(test)] |
270 #[cfg(test)] |
268 mod tests { |
271 mod tests { |
269 use std::collections::VecDeque; |
272 use std::collections::VecDeque; |
270 use rand::Rng; |
273 use rand::Rng; |
271 |
274 |
272 use crate::{card::Card, player::{Player, PlayerCard}, row::Row, table::Table}; |
275 use crate::{card::Card, player::{Player, PlayerCard}, row::Row, table::Table}; |
273 |
276 |
274 #[test] |
277 #[test] |
|
278 /// Test Card, and point generation logic. |
275 fn card_values() { |
279 fn card_values() { |
276 let card_values = vec![1,2,5,10,33,55,77]; |
280 let card_values = vec![1,2,5,10,33,55,77]; |
277 let card_points = vec![1,1,2,3, 5, 7, 5]; |
281 let card_points = vec![1,1,2,3, 5, 7, 5]; |
278 for i in 1 .. card_values.len() { |
282 for i in 1 .. card_values.len() { |
279 let c = Card::new( card_values[i] ); |
283 let c = Card::new( card_values[i] ); |
387 let table = Table::new(row_cards); |
391 let table = Table::new(row_cards); |
388 table |
392 table |
389 } |
393 } |
390 } |
394 } |
391 |
395 |
392 /* |
|
393 |
|
394 - 1-104 lap, |
|
395 - *5 - 2 |
|
396 - *0 - 3 |
|
397 - NN - 5 |
|
398 - 55 - 7 |
|
399 - deck |
|
400 - jatekosok; kezben tartott lapok; elvitt lapok; pontszamok; counter: elvitt sorok, okrok, total pont |
|
401 -- keveres (keveresek szama) |
|
402 -- osztas: mindenki 10 lap |
|
403 -- start sorok: 5 kartya |
|
404 - jatek (jatekok szama) |
|
405 -- mindenki a felso lapot kiteszi |
|
406 -- szamsorrendben felkerulnek, aki viszi, viszi |
|
407 --- ha kisebb, akkor dontes |
|
408 ---- ha van legkevesebb, viszi |
|
409 ---- ha tobb min van, random valaszt |
|
410 - osszesites |
|
411 -- okrok, elvitt sorok |
|
412 -- keveresek szama, jatekok szama, eltelt ido |
|
413 - deck osszegyujtes |
|
414 |
|
415 |
|
416 */ |
|