File: map_range_to_range_test.go

package info (click to toggle)
golang-github-pterm-pterm 0.12.79-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,640 kB
  • sloc: makefile: 4
file content (15 lines) | stat: -rw-r--r-- 465 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package internal_test

import (
	"testing"

	"github.com/MarvinJWendt/testza"
	"github.com/pterm/pterm/internal"
)

func TestMapRangeToRange(t *testing.T) {
	testza.AssertEqual(t, 127, internal.MapRangeToRange(0, 100, 0, 255, 50))
	testza.AssertEqual(t, 127, internal.MapRangeToRange(0, 400, 0, 255, 200))
	testza.AssertEqual(t, 127, internal.MapRangeToRange(-200, 200, 0, 255, 0))
	testza.AssertEqual(t, 127, internal.MapRangeToRange(0, 200.123, 0, 254.3, 100))
}