File: math.liq

package info (click to toggle)
liquidsoap 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,844 kB
  • sloc: ml: 74,136; javascript: 27,320; ansic: 505; sh: 139; xml: 114; lisp: 96; makefile: 26
file content (33 lines) | stat: -rw-r--r-- 553 bytes parent folder | download | duplicates (2)
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
#!../../liquidsoap ../test.liq

def test_db_lin() =
  x = 5.

  test.almost_equal(dB_of_lin(lin_of_dB(x)), x)
  test.almost_equal(lin_of_dB(dB_of_lin(x)), x)

  y = -x
  test.equal(y, -5.)
  test.equal(y == -5., true)

  y = 1 + -2
  test.equal(y, -1)

  def f() =
    1 + -2
  end
  test.equal(f(), -1)

  test.equal(nan == nan, false)
  test.equal(nan != nan, true)

  test.equal(1e4, 10000.0)
  test.equal(1e+4, 10000.0)
  test.equal(1e-4, 0.0001)
  test.equal(1.1e-4, 0.00011)
  test.equal(1.e-4, 0.0001)

  test.pass()
end

test.check(test_db_lin)