Files
notas/test/note_positioning_test.dart

21 lines
659 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:notas/data/note_positioning.dart';
void main() {
test('converts between stored and displayed positions', () {
expect(toStoredNotePosition(1500.5), 15005);
expect(fromStoredNotePosition(15005), 1500.5);
});
test('supports descending gaps and rebalance', () {
expect(nextTopNotePosition(<int>[0, 10000, 20000]), 30000);
expect(
midpointNotePosition(higherPosition: 20000, lowerPosition: 10000),
15000,
);
expect(midpointNotePosition(higherPosition: 2, lowerPosition: 1), isNull);
expect(rebalanceNotePositions(3), <int>[20000, 10000, 0]);
});
}