-
Notifications
You must be signed in to change notification settings - Fork 1
/
2x2x2.rs
116 lines (106 loc) · 2.69 KB
/
2x2x2.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// 2x2x2 Tests
//
use test_case::test_case;
use cubesim::prelude::*;
use cubesim::prelude::Face::*;
use cubesim::{GeoCube, FaceletCube};
use cubesim::solved_state;
//
// State Tests
//
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn solved_state(cube: impl Cube) {
assert_eq!(cube.state(), vec![
U, U, U, U,
R, R, R, R,
F, F, F, F,
D, D, D, D,
L, L, L, L,
B, B, B, B,
]);
}
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn u_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::U(MoveVariant::Standard)).state(), vec![
U, U, U, U,
B, B, R, R,
R, R, F, F,
D, D, D, D,
F, F, L, L,
L, L, B, B
]);
}
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn r_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::R(MoveVariant::Standard)).state(), vec![
U, F, U, F,
R, R, R, R,
F, D, F, D,
D, B, D, B,
L, L, L, L,
U, B, U, B
]);
}
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn f_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::F(MoveVariant::Standard)).state(), vec![
U, U, L, L,
U, R, U, R,
F, F, F, F,
R, R, D, D,
L, D, L, D,
B, B, B, B
]);
}
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn d_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::D(MoveVariant::Standard)).state(), vec![
U, U, U, U,
R, R, F, F,
F, F, L, L,
D, D, D, D,
L, L, B, B,
B, B, R, R
]);
}
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn l_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::L(MoveVariant::Standard)).state(), vec![
B, U, B, U,
R, R, R, R,
U, F, U, F,
F, D, F, D,
L, L, L, L,
B, D, B, D
]);
}
#[test_case(GeoCube::new(2) ; "Geometric Cube")]
#[test_case(FaceletCube::new(2) ; "Facelet Cube")]
fn b_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::B(MoveVariant::Standard)).state(), vec![
R, R, U, U,
R, D, R, D,
F, F, F, F,
D, D, L, L,
U, L, U, L,
B, B, B, B
]);
}
#[test]
fn generic_solved_state() {
assert_eq!(solved_state(2), vec![
U, U, U, U,
R, R, R, R,
F, F, F, F,
D, D, D, D,
L, L, L, L,
B, B, B, B
]);
}