import 'package:flutter_test/flutter_test.dart'; import 'package:match_three/game/models/gem.dart'; import 'package:match_three/game/models/grid.dart'; import 'package:match_three/game/systems/match_detector.dart'; void main() { group('Match Three Game Tests', () { test('Grid initialization creates 8x8 grid', () { final grid = GameGrid(); for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { expect(grid.getGem(row, col), isNotNull); } } }); test('Match detector validates adjacent positions', () { final grid = GameGrid(); // Test adjacent positions (should be valid) expect(MatchDetector.isValidSwap(grid, 0, 0, 0, 1), isTrue); expect(MatchDetector.isValidSwap(grid, 0, 0, 1, 0), isTrue); // Test non-adjacent positions (should be invalid) expect(MatchDetector.isValidSwap(grid, 0, 0, 0, 2), isFalse); expect(MatchDetector.isValidSwap(grid, 0, 0, 2, 0), isFalse); }); test('Gem creation with correct properties', () { final gem = Gem(type: 1, row: 2, col: 3); expect(gem.type, equals(1)); expect(gem.row, equals(2)); expect(gem.col, equals(3)); expect(gem.isMatched, isFalse); expect(gem.isSpecial, isFalse); }); }); }