45 lines
2.3 KiB
Dart
45 lines
2.3 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:flutter_application_1/enums.dart';
|
|
import 'package:flutter_application_1/calculator.dart';
|
|
|
|
void main() {
|
|
group('Calculation Tests', () {
|
|
test('Test calculateInvestedMoney function', () {
|
|
// Testen mit verschiedenen Eingabewerten
|
|
expect(calculateInvestedMoney(1000, 100, 5, []), equals(7000.0));
|
|
expect(calculateInvestedMoney(2000, 50, 10, []), equals(8000.0));
|
|
});
|
|
test('Test calculateCompoundInterest function', () {
|
|
// Testen mit jährlicher Auszahlung
|
|
List<double> investedMoneyListYearly = [];
|
|
List<double> compoundInterestListYearly = [];
|
|
calculateInvestedMoney(1000, 100, 10, investedMoneyListYearly);
|
|
expect(calculateCompoundInterest(1000, 100, 5, 10, PayoutInterval.yearly, investedMoneyListYearly, compoundInterestListYearly), equals(16722.0));
|
|
|
|
// Testen mit monatlicher Auszahlung
|
|
List<double> investedMoneyListMonthly = [];
|
|
List<double> compoundInterestListMonthly = [];
|
|
calculateInvestedMoney(2000, 50, 10, investedMoneyListMonthly);
|
|
expect(calculateCompoundInterest(2000, 50, 5, 10, PayoutInterval.monthly, investedMoneyListMonthly, compoundInterestListMonthly), equals(11058.0));
|
|
});
|
|
});
|
|
group('Edge Case Tests', () {
|
|
test('Test calculateInvestedMoney function with extremely high input values', () {
|
|
// Testen mit extrem hohen Eingabewerten
|
|
expect(calculateInvestedMoney(1e15, 1e12, 100, []), equals(2.2e15));
|
|
});
|
|
test('Test calculateInvestedMoney function with extremely low input values', () {
|
|
// Testen mit extrem niedrigen Eingabewerten
|
|
expect(calculateInvestedMoney(0, 0, 0, []), equals(0.0));
|
|
expect(calculateInvestedMoney(0.1, 0.01, 0.001, []), equals(0.0));
|
|
});
|
|
test('Test calculateCompoundInterest function with extremely high interest rate', () {
|
|
// Testen mit extrem hohen Zinssatz
|
|
List<double> investedMoneyListHighInterest = [];
|
|
List<double> compoundInterestListHighInterest = [];
|
|
calculateInvestedMoney(1000, 100, 10, investedMoneyListHighInterest);
|
|
expect(calculateCompoundInterest(1000, 100, 1000, 10, PayoutInterval.yearly, investedMoneyListHighInterest, compoundInterestListHighInterest), equals(29049915553000.0));
|
|
});
|
|
});
|
|
}
|