LCOV - code coverage report
Current view: top level - Users/yeradis/Projects/Garage/dart/stay_points.dart/test - location_test.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 24 24 100.0 %
Date: 2017-10-10 20:17:03 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:stay_points/stay_points.dart';
       2             : import 'package:stay_points/src/identification/model/coordinate.dart';
       3             : import 'package:test/test.dart';
       4             : 
       5             : void main() {
       6           1 :     group('Distance between locations', () {
       7             :         Location location1;
       8             :         Location location2;
       9             : 
      10           1 :         setUp(() {
      11           1 :             var lat = new LocationDegrees(degrees: 41.139129);
      12           1 :             var lon = new LocationDegrees(degrees: 1.402244);
      13           1 :             location1 = new Location(latitude: lat, longitude: lon);
      14             : 
      15           1 :             lat = new LocationDegrees(degrees: 41.139074);
      16           1 :             lon = new LocationDegrees(degrees: 1.402315);
      17           1 :             location2 = new Location(latitude: lat, longitude: lon);
      18             :         });
      19             : 
      20           1 :         test('Distance from location 1 to location 2 - Should return non zero', () {
      21           2 :             expect(location1.distanceTo(location2), isNonZero);
      22             :         });
      23             : 
      24           1 :         test('Distance from location 1 to location 2 - Should return non negative', () {
      25           2 :             expect(location1.distanceTo(location2), isNonNegative);
      26             :         });
      27             : 
      28           1 :         test('Distance from location1 to same location should be Zero', () {
      29           2 :             expect(location1.distanceTo(location1), isZero);
      30             :         });
      31             : 
      32           1 :         test('Distance from location1 to location2 shold be 8.529573134008796', () {
      33           3 :             expect(location1.distanceTo(location2), greaterThanOrEqualTo(8.529573134008796));
      34             :         });
      35             : 
      36           1 :         test('Having 41.139129 should return 0.7180 radians', () {
      37           4 :             expect(location1.latitude.inRadians, greaterThanOrEqualTo(0.7180));
      38             :         });
      39             : 
      40           1 :         test('Location1 should not be equal to Location2', () {
      41           1 :             int comparison = location1.compareTo(location2);
      42           2 :             expect(comparison, equals(-1));
      43             :         });
      44             : 
      45           1 :         test('Location1 should  be equal to Location1', () {
      46           1 :             int comparison = location1.compareTo(location1);
      47           2 :             expect(comparison, equals(0));
      48             :         });
      49             :     });
      50             : }

Generated by: LCOV version 1.13