test.rs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. use crate::grid::group_test::script::GridGroupTest;
  2. use crate::grid::group_test::script::GroupScript::*;
  3. #[tokio::test]
  4. async fn board_init_test() {
  5. let mut test = GridGroupTest::new().await;
  6. let scripts = vec![
  7. AssertGroupCount(3),
  8. AssertGroup {
  9. group_index: 0,
  10. row_count: 2,
  11. },
  12. AssertGroup {
  13. group_index: 1,
  14. row_count: 2,
  15. },
  16. AssertGroup {
  17. group_index: 2,
  18. row_count: 1,
  19. },
  20. ];
  21. test.run_scripts(scripts).await;
  22. }
  23. #[tokio::test]
  24. async fn board_move_row_test() {
  25. let mut test = GridGroupTest::new().await;
  26. let group = test.group_at_index(0).await;
  27. let scripts = vec![
  28. MoveRow {
  29. from_group_index: 0,
  30. from_row_index: 0,
  31. to_group_index: 1,
  32. to_row_index: 1,
  33. },
  34. AssertGroup {
  35. group_index: 0,
  36. row_count: 1,
  37. },
  38. AssertGroup {
  39. group_index: 1,
  40. row_count: 3,
  41. },
  42. AssertGroupRow {
  43. group_index: 1,
  44. row_index: 1,
  45. row: group.rows.get(0).unwrap().clone(),
  46. },
  47. ];
  48. test.run_scripts(scripts).await;
  49. }