File: util_test.go

package info (click to toggle)
golang-github-tdewolff-parse 2.7.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 836 kB
  • sloc: makefile: 2
file content (34 lines) | stat: -rw-r--r-- 626 bytes parent folder | download | duplicates (3)
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
26
27
28
29
30
31
32
33
34
package css

import (
	"testing"

	"github.com/tdewolff/test"
)

func TestIsIdent(t *testing.T) {
	test.That(t, IsIdent([]byte("color")))
	test.That(t, !IsIdent([]byte("4.5")))
}

func TestIsURLUnquoted(t *testing.T) {
	test.That(t, IsURLUnquoted([]byte("http://x")))
	test.That(t, !IsURLUnquoted([]byte(")")))
}

func TestHsl2Rgb(t *testing.T) {
	r, g, b := HSL2RGB(0.0, 1.0, 0.5)
	test.T(t, r, 1.0)
	test.T(t, g, 0.0)
	test.T(t, b, 0.0)

	r, g, b = HSL2RGB(1.0, 1.0, 0.5)
	test.T(t, r, 1.0)
	test.T(t, g, 0.0)
	test.T(t, b, 0.0)

	r, g, b = HSL2RGB(0.66, 0.0, 1.0)
	test.T(t, r, 1.0)
	test.T(t, g, 1.0)
	test.T(t, b, 1.0)
}