A whole lot of stuff

This commit is contained in:
Courtney Arnold 2026-08-18 11:04:58 -05:00
parent faf319322a
commit ad850d2be6
50 changed files with 3013 additions and 213 deletions

View file

@ -0,0 +1,29 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:fuel_tax_tracker/services/estimated_refund.dart';
void main() {
test('the rate itself is 12.5 cents per gallon', () {
expect(moHighwayFuelTaxRefundRatePerGallon, 0.125);
});
test('multiplies whole gallons by the rate', () {
expect(estimatedFuelRefund(10), 1.25);
expect(estimatedFuelRefund(20), 2.50);
expect(estimatedFuelRefund(0), 0);
});
test('rounds fractional gallons to the nearest whole gallon before multiplying', () {
// 10.523 rounds up to 11 gallons: 11 * $0.125 = $1.375, floored to $1.37.
expect(estimatedFuelRefund(10.523), 1.37);
// 10.4 rounds down to 10 gallons: 10 * $0.125 = $1.25 exactly.
expect(estimatedFuelRefund(10.4), 1.25);
});
test('rounds the resulting cents down, never up', () {
// 1 gallon * $0.125 = $0.125 — rounding to the nearest cent would give
// $0.13, but this must floor to $0.12 instead.
expect(estimatedFuelRefund(1), 0.12);
// 3 gallons * $0.125 = $0.375 — floors to $0.37, not $0.38.
expect(estimatedFuelRefund(3), 0.37);
});
}