aboutsummaryrefslogtreecommitdiffstats
path: root/test.sh
blob: 51705d99fcc1873b5fb4fb3d23505af4e9784358 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

set -v
set -e

if test -d .testdir; then
   rm -r .testdir
fi

mkdir -p .testdir/dev
printf '%i\n' 50 > .testdir/dev/max_brightness
printf '%i\n' 25 > .testdir/dev/brightness

test $(./test -ga) = 50.00%
test $(./test -g dev) = 50.00%

./test -s +30 dev
test $(./test -ga) = 100.00%

./test -s 5 dev
test $(./test -ga) = 10.00%

./test -s -1 dev
test $(./test -ga) = 8.00%

./test -s +100%% dev
test $(./test -ga) = 16.00%

./test -s -50%% dev
test $(./test -ga) = 8.00%

./test -s 200%% dev
test $(./test -ga) = 16.00%

./test -s 50% dev
test $(./test -ga) = 50.00%

./test -s -10% dev
test $(./test -ga) = 40.00%

./test -s +20% dev
test $(./test -ga) = 60.00%

mkdir .testdir/acpi_video
printf '%i\n' 50 > .testdir/acpi_video/max_brightness
printf '%i\n' 25 > .testdir/acpi_video/brightness

test $(./test -g acpi_video) = 50.00%

rm -r .testdir/acpi_video
printf '%s\n' 5 +15 -5 +20% | ./test dev
test $(./test -g dev) = 50.00%

printf '%s\n' 5 +15 -5 +10% | ./test -a
test $(./test -ga) = 40.00%

rm -r .testdir