44 lines
1.7 KiB
Dart
44 lines
1.7 KiB
Dart
|
// This is a basic Flutter widget test.
|
||
|
//
|
||
|
// To perform an interaction with a widget in your test, use the WidgetTester
|
||
|
// utility in the flutter_test package. For example, you can send tap and scroll
|
||
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||
|
// tree, read text, and verify that the values of widget properties are correct.
|
||
|
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:energy/widgets/calculate.dart';
|
||
|
import 'package:flutter_test/flutter_test.dart';
|
||
|
|
||
|
void main() {
|
||
|
test('tests', () async {
|
||
|
// Build our app and trigger a frame.
|
||
|
Calculate cal1 = Calculate(5, 6, 5, 6, 6);
|
||
|
Calculate cal2 = Calculate(12, 24, 5, 5, 20);
|
||
|
Calculate cal3 = Calculate(100, 100, 212, 300, 5000);
|
||
|
Calculate cal4 = Calculate(1, 1, 2, 2, 6);
|
||
|
Calculate cal5 = Calculate(0, 0, 0, 0, 0);
|
||
|
|
||
|
|
||
|
expect(cal1.calculateLWater(), 0.00018449284009546538);// testing with small values
|
||
|
expect(cal1.calculateJoule(), 61.842);
|
||
|
expect(cal1.calculateKgIron(), 0.00018188823529411764);
|
||
|
|
||
|
expect(cal2.calculateLWater(), 0.0042959427207637235);// testing with middle Values and same height
|
||
|
expect(cal2.calculateJoule(), 1440);
|
||
|
expect(cal2.calculateKgIron(), 0.0042352941176470585);
|
||
|
|
||
|
expect(cal3.calculateLWater(), 12.873150357995227);// testing with big Values and same speed
|
||
|
expect(cal3.calculateJoule(), 4315080);
|
||
|
expect(cal3.calculateKgIron(), 12.691411764705883);
|
||
|
|
||
|
expect(cal4.calculateJoule(), 0);// testing with no differents between speed and height
|
||
|
expect(cal4.calculateLWater(), 0);
|
||
|
expect(cal4.calculateKgIron(), 0);
|
||
|
|
||
|
expect(cal5.calculateJoule(), 0);// testing with 0
|
||
|
expect(cal5.calculateLWater(), 0);
|
||
|
expect(cal5.calculateKgIron(), 0);
|
||
|
|
||
|
});
|
||
|
}
|