From 46f5960d43d8e071a07ead18e69c5d6df04d5284 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Sun, 6 Nov 2022 19:32:05 -0500 Subject: [PATCH] test(types): add pair tests --- packages/wyatt_type_utils/test/pair_test.dart | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 packages/wyatt_type_utils/test/pair_test.dart diff --git a/packages/wyatt_type_utils/test/pair_test.dart b/packages/wyatt_type_utils/test/pair_test.dart new file mode 100644 index 00000000..d4f7ced2 --- /dev/null +++ b/packages/wyatt_type_utils/test/pair_test.dart @@ -0,0 +1,39 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:test/test.dart'; +import 'package:wyatt_type_utils/wyatt_type_utils.dart'; + +void main() { + group('Pair', () { + test('left returns correct value', () { + const Pair myPair = Pair(42, false); + expect(myPair.left, 42); + }); + test('right returns correct value', () { + const Pair myPair = Pair(42, false); + expect(myPair.right, false); + }); + test('toString() returns correct value', () { + const Pair myPair = Pair(42, false); + expect(myPair.toString(), '(42, false)'); + }); + test('toList() returns correct values', () { + const Pair myPair = Pair(42, 10); + expect(myPair.toList(), [42, 10]); + }); + }); +}