Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: samples/pop_pop_win/test/field_test.dart

Issue 786443002: Delete pop-pop-win from the repo (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/pop_pop_win/readme.md ('k') | samples/pop_pop_win/test/game_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 library pop_pop_win.field_test;
5
6 import 'package:pop_pop_win/src/game.dart';
7 import 'package:unittest/unittest.dart';
8
9 import 'test_util.dart';
10
11 void main() {
12 test('defaults', _testDefaults);
13 test('bombCount', _testBombCount);
14 test('fromSquares', _testFromSquares);
15 test('adjacent', _testAdjacent);
16 }
17
18 void _testDefaults() {
19 var f = new Field();
20
21 expect(f.bombCount, equals(40));
22 expect(f.height, equals(16));
23 expect(f.width, equals(16));
24 }
25
26 void _testBombCount() {
27 var f = new Field();
28
29 int bombCount = 0;
30 for (int x = 0; x < 16; x++) {
31 for (int y = 0; y < 16; y++) {
32 if (f.get(x, y)) {
33 bombCount++;
34 }
35 }
36 }
37 expect(bombCount, equals(f.bombCount));
38 }
39
40 void _testFromSquares() {
41 var f = new Field.fromSquares(2, 2, [true, true, true, false]);
42 expect(f.height, equals(2));
43 expect(f.width, equals(2));
44 expect(f.bombCount, equals(3));
45 }
46
47 void _testAdjacent() {
48 var f = getSampleField();
49
50 expect(f.bombCount, equals(13));
51
52 for (int x = 0; x < f.width; x++) {
53 for (int y = 0; y < f.height; y++) {
54 var i = x + y * f.width;
55 var adj = f.getAdjacentCount(x, y);
56 expect(adj, equals(SAMPLE_FIELD[i]));
57 }
58 }
59 }
OLDNEW
« no previous file with comments | « samples/pop_pop_win/readme.md ('k') | samples/pop_pop_win/test/game_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698