42c4c3c1bd
Change-Id: I542369fc2d8443bb0094fdedc11596fdc2f20e2d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159084 Commit-Queue: Javier López-Contreras <jlcontreras@google.com> Reviewed-by: Erik Ernst <eernst@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
26 lines
802 B
Dart
26 lines
802 B
Dart
// Copyright (c) 2020, 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 'value_class_support_lib.dart';
|
|
|
|
@valueClass
|
|
class Animal {
|
|
final int numberOfLegs;
|
|
}
|
|
|
|
main() {
|
|
Animal firstAnimal = Animal(numberOfLegs: 4);
|
|
Animal secondAnimal = Animal(numberOfLegs: 4);
|
|
Animal thirdAnimal = Animal(numberOfLegs: 3);
|
|
|
|
expect(true, firstAnimal == secondAnimal);
|
|
expect(false, firstAnimal == thirdAnimal);
|
|
|
|
expect(true, firstAnimal.hashCode == secondAnimal.hashCode);
|
|
expect(false, firstAnimal.hashCode == thirdAnimal.hashCode);
|
|
}
|
|
|
|
expect(Object? expected, Object? actual) {
|
|
if (expected != actual) throw 'Expected=$expected, actual=$actual';
|
|
} |