@@ -77,96 +77,135 @@ void getIndexDigit() {
7777
7878 @ Test
7979 void constructCell () {
80- assertEquals (h3 .constructCell (0 , 0 , ImmutableList .of ()), 576495936675512319L );
80+ assertEquals (h3 .constructCell (0 , ImmutableList .of ()), 576495936675512319L );
81+ assertEquals (h3 .constructCell (0 , ImmutableList .of (), 0 ), 576495936675512319L );
8182 assertThrows (
82- H3Exception .class ,
83+ IllegalArgumentException .class ,
8384 () ->
8485 // Invalid res
85- h3 .constructCell (-1 , 0 , ImmutableList .of ()));
86+ h3 .constructCell (0 , ImmutableList .of (), -1 ));
87+ assertThrows (
88+ H3Exception .class ,
89+ () ->
90+ // Invalid base cell
91+ h3 .constructCell (-1 , ImmutableList .of ()));
8692 assertThrows (
8793 H3Exception .class ,
8894 () ->
8995 // Invalid base cell
90- h3 .constructCell (0 , -1 , ImmutableList .of ()));
96+ h3 .constructCell (-1 , ImmutableList .of (), 0 ));
9197 assertThrows (
9298 IllegalArgumentException .class ,
9399 () ->
94100 // Invalid digit list
95- h3 .constructCell (1 , 5 , ImmutableList .of ()));
96- // Invalid digit list -- ignored
97- h3 .constructCell (1 , 5 , ImmutableList .of (1 , 2 ));
98- assertEquals (h3 .constructCell (1 , 5 , ImmutableList .of (1 )), 581149069884260351L );
101+ h3 .constructCell (5 , ImmutableList .of (), 1 ));
102+ assertThrows (
103+ IllegalArgumentException .class ,
104+ () ->
105+ // Invalid digit list
106+ h3 .constructCell (5 , ImmutableList .of (1 , 2 ), 1 ));
107+ assertEquals (h3 .constructCell (5 , ImmutableList .of (1 )), 581149069884260351L );
108+ assertEquals (h3 .constructCell (5 , ImmutableList .of (1 ), 1 ), 581149069884260351L );
109+ assertThrows (
110+ H3Exception .class ,
111+ () ->
112+ // Deleted subsequence
113+ h3 .constructCell (4 , ImmutableList .of (1 )));
99114 assertThrows (
100115 H3Exception .class ,
101116 () ->
102117 // Deleted subsequence
103- h3 .constructCell (1 , 4 , ImmutableList .of (1 )));
118+ h3 .constructCell (4 , ImmutableList .of (1 ), 1 ));
104119 assertThrows (
105120 IllegalArgumentException .class ,
106121 () ->
107122 // Too few digits
108- h3 .constructCell (7 , 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 )));
123+ h3 .constructCell (20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 ), 7 ));
109124 assertEquals (
110- h3 .constructCell (15 , 100 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 )),
125+ h3 .constructCell (100 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 )),
126+ 0x8fc8539714e5c53L );
127+ assertEquals (
128+ h3 .constructCell (100 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 ), 15 ),
111129 0x8fc8539714e5c53L );
112130 assertThrows (
113131 IllegalArgumentException .class ,
114132 () ->
115133 // Too many digits
116134 h3 .constructCell (
117- 15 , 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 0 , 0 , 0 )));
135+ 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 0 , 0 , 0 )));
136+ assertThrows (
137+ IllegalArgumentException .class ,
138+ () ->
139+ // Too many digits
140+ h3 .constructCell (
141+ 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 0 , 0 , 0 ), 15 ));
118142 }
119143
120144 @ Test
121145 void constructCellAddress () {
122- assertEquals (h3 .constructCellAddress (0 , 0 , ImmutableList .of ()), "8001fffffffffff" );
146+ assertEquals (h3 .constructCellAddress (0 , ImmutableList .of ()), "8001fffffffffff" );
147+ assertEquals (h3 .constructCellAddress (0 , ImmutableList .of (), 0 ), "8001fffffffffff" );
123148 assertThrows (
124- H3Exception .class ,
149+ IllegalArgumentException .class ,
125150 () ->
126151 // Invalid res
127- h3 .constructCellAddress (-1 , 0 , ImmutableList .of ()));
152+ h3 .constructCellAddress (0 , ImmutableList .of (), -1 ));
153+ assertThrows (
154+ H3Exception .class ,
155+ () ->
156+ // Invalid base cell
157+ h3 .constructCellAddress (-1 , ImmutableList .of ()));
128158 assertThrows (
129159 H3Exception .class ,
130160 () ->
131161 // Invalid base cell
132- h3 .constructCellAddress (0 , -1 , ImmutableList .of ()));
162+ h3 .constructCellAddress (-1 , ImmutableList .of (), 0 ));
133163 assertThrows (
134164 IllegalArgumentException .class ,
135165 () ->
136166 // Invalid digit list
137- h3 .constructCellAddress (1 , 5 , ImmutableList .of ()));
138- // Invalid digit list -- ignored
139- h3 .constructCellAddress (1 , 5 , ImmutableList .of (1 , 2 ));
140- assertEquals (h3 .constructCellAddress (1 , 5 , ImmutableList .of (1 )), "810a7ffffffffff" );
167+ h3 .constructCellAddress (5 , ImmutableList .of (), 1 ));
168+ assertThrows (
169+ IllegalArgumentException .class ,
170+ () ->
171+ // Invalid digit list
172+ h3 .constructCellAddress (5 , ImmutableList .of (1 , 2 ), 1 ));
173+ assertEquals (h3 .constructCellAddress (5 , ImmutableList .of (1 )), "810a7ffffffffff" );
174+ assertEquals (h3 .constructCellAddress (5 , ImmutableList .of (1 ), 1 ), "810a7ffffffffff" );
175+ assertThrows (
176+ H3Exception .class ,
177+ () ->
178+ // Deleted subsequence
179+ h3 .constructCellAddress (4 , ImmutableList .of (1 )));
141180 assertThrows (
142181 H3Exception .class ,
143182 () ->
144183 // Deleted subsequence
145- h3 .constructCellAddress (1 , 4 , ImmutableList .of (1 )));
184+ h3 .constructCellAddress (4 , ImmutableList .of (1 ), 1 ));
146185 assertThrows (
147186 IllegalArgumentException .class ,
148187 () ->
149188 // Too few digits
150- h3 .constructCellAddress (7 , 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 )));
189+ h3 .constructCellAddress (20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 ), 7 ));
190+ assertEquals (
191+ h3 .constructCellAddress (100 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 )),
192+ "8fc8539714e5c53" );
151193 assertEquals (
152194 h3 .constructCellAddress (
153- 15 , 100 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 )),
195+ 100 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 ), 15 ),
154196 "8fc8539714e5c53" );
155197 assertThrows (
156198 IllegalArgumentException .class ,
157199 () ->
158200 // Too many digits
159201 h3 .constructCellAddress (
160- 15 , 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 0 , 0 , 0 )));
161- }
162-
163- @ Test
164- void constructCellErrors () {
202+ 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 0 , 0 , 0 )));
165203 assertThrows (
166- H3Exception .class ,
204+ IllegalArgumentException .class ,
167205 () ->
168- // Invalid index
169- h3 .constructCell (1 , 4 , ImmutableList .of (1 )));
206+ // Too many digits
207+ h3 .constructCellAddress (
208+ 20 , ImmutableList .of (1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 4 , 5 , 6 , 1 , 2 , 3 , 0 , 0 , 0 ), 15 ));
170209 }
171210
172211 @ Test
0 commit comments