aboutsummaryrefslogtreecommitdiff
path: root/ride/difficulty_example_test.go
blob: bd87f584d51cf2e43c2875b81d38c50072626645 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

package ride_test

import (
	"testing"

	"github.com/martinlehoux/biking_home/climb"
	"github.com/martinlehoux/biking_home/ride"
	"github.com/stretchr/testify/assert"
)

func TestCotacolExampleRide(t *testing.T) {
	r, err := ride.ParseFile(parser, "../examples/2022-07-21.Pogacar.gpx")
	assert.NoError(t, err)
	assert.InDelta(t, 3049.0, climb.Cotacol(r.Distances, r.Elevations), 1)
}

func TestCotacolHautacamClimbfinderReference(t *testing.T) {
	r, err := ride.ParseFile(parser, "../examples/2022-07-21.Pogacar.gpx")
	assert.NoError(t, err)
	detected := climb.Detect(r.Route, nil, climb.ClimbSlopeMinimum)
	assert.Len(t, detected, 6)
	hautacam := detected[5].Climb
	assert.InDelta(t, 128.6, hautacam.Distances[0]/1000, 0.1)
	assert.InDelta(t, 930.0, hautacam.DifficultyScore(), 10)
}