Skip to content

Commit

Permalink
test: data models
Browse files Browse the repository at this point in the history
  • Loading branch information
jsgalarraga committed Feb 27, 2024
1 parent a92ff14 commit c7c16a1
Show file tree
Hide file tree
Showing 4 changed files with 238 additions and 230 deletions.
1 change: 1 addition & 0 deletions .github/workflows/board_generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ jobs:
with:
dart_sdk: stable
working_directory: packages/board_generator
coverage_excludes: "**/*.g.dart"
21 changes: 2 additions & 19 deletions packages/board_generator/lib/models/data_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ library data_model;

import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:characters/characters.dart';

part 'data_model.g.dart';

@SerializersFor([Location, Crossword, CrosswordCharacter])

/// The global [Serializers] object.
final Serializers serializers = _$serializers;

///{@template crossword}
/// A crossword puzzle data model.
/// {@endtemplate}
Expand All @@ -21,9 +15,6 @@ abstract class Crossword implements Built<Crossword, CrosswordBuilder> {

Crossword._();

/// The serializer for this data model.
static Serializer<Crossword> get serializer => _$crosswordSerializer;

/// The list of unused candidate words that can be added to this crossword.
BuiltList<String> get candidates;

Expand Down Expand Up @@ -199,10 +190,9 @@ abstract class Crossword implements Built<Crossword, CrosswordBuilder> {
for (final (idx, character) in word.characters.indexed) {
final characterLocation =
location.rebuild((b) => b..across = location.across + idx);
b.characters.updateValue(
b.characters.putIfAbsent(
characterLocation,
(b) => b.rebuild((b) => b.acrossWord = word),
ifAbsent: () => CrosswordCharacter(
() => CrosswordCharacter(
(b) => b
..acrossWord = word
..character = character,
Expand Down Expand Up @@ -240,9 +230,6 @@ abstract class Location implements Built<Location, LocationBuilder> {

Location._();

/// The serializer for this data model.
static Serializer<Location> get serializer => _$locationSerializer;

/// The horizontal part of the location.
int get across;

Expand All @@ -262,10 +249,6 @@ abstract class CrosswordCharacter

CrosswordCharacter._();

/// The serializer for this data model.
static Serializer<CrosswordCharacter> get serializer =>
_$crosswordCharacterSerializer;

/// The character at this location.
String get character;

Expand Down
211 changes: 0 additions & 211 deletions packages/board_generator/lib/models/data_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c7c16a1

Please sign in to comment.