d4t_formulas/.pub-cache/hosted/pub.dev/path-1.9.1/test/utils.dart
Álvaro González 1d339653d5 feat: add formula data classes with strict JSON parsing
- Add VariableSpec class with magnitude field validation
- Add Formula class supporting multiple input/output variables
- Support d4rt_code as string or object with code field
- Add comprehensive tests for parsing and serialization
- Fix broken test import in pruebas_d4rt_test.dart

Follows README.md format requirements exactly
2025-08-21 17:15:00 +02:00

32 lines
1.4 KiB
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
/// A matcher for a closure that throws a [p.PathException].
final throwsPathException = throwsA(const TypeMatcher<p.PathException>());
void expectEquals(p.Context context, String path1, String path2) {
expect(context.equals(path1, path2), isTrue,
reason: 'Expected "$path1" to equal "$path2".');
expect(context.equals(path2, path1), isTrue,
reason: 'Expected "$path2" to equal "$path1".');
expect(context.hash(path1), equals(context.hash(path2)),
reason: 'Expected "$path1" to hash the same as "$path2".');
}
void expectNotEquals(p.Context context, String path1, String path2,
{bool allowSameHash = false}) {
expect(context.equals(path1, path2), isFalse,
reason: 'Expected "$path1" not to equal "$path2".');
expect(context.equals(path2, path1), isFalse,
reason: 'Expected "$path2" not to equal "$path1".');
// Hash collisions are allowed, but the test author should be explicitly aware
// when they occur.
if (allowSameHash) return;
expect(context.hash(path1), isNot(equals(context.hash(path2))),
reason: 'Expected "$path1" not to hash the same as "$path2".');
}