test(types): add pair tests

This commit is contained in:
Hugo Pointcheval 2022-11-06 19:32:05 -05:00
parent d63e7a8a07
commit 46f5960d43
Signed by: hugo
GPG Key ID: A9E8E9615379254F

View File

@ -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 <https://www.gnu.org/licenses/>.
import 'package:test/test.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
void main() {
group('Pair<L,R>', () {
test('left returns correct value', () {
const Pair<int, bool> myPair = Pair(42, false);
expect(myPair.left, 42);
});
test('right returns correct value', () {
const Pair<int, bool> myPair = Pair(42, false);
expect(myPair.right, false);
});
test('toString() returns correct value', () {
const Pair<int, bool> myPair = Pair(42, false);
expect(myPair.toString(), '(42, false)');
});
test('toList() returns correct values', () {
const Pair<int, int> myPair = Pair(42, 10);
expect(myPair.toList(), [42, 10]);
});
});
}