dtas.git  about / heads / tags
duct tape audio suite for *nix
blob 729e7f7d969cbbb329fda66a5fa46b57bf265070 980 bytes (raw)
name: testtest_rg_state.rb 	 # note: path name is non-authoritative(*)

 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
 
# Copyright (C) 2013-2020 all contributors <dtas-all@nongnu.org>
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
# frozen_string_literal: true
require './test/helper'
require 'dtas/rg_state'

class TestRGState < Testcase

  def test_rg_state
    rg = DTAS::RGState.new
    assert_equal({}, rg.to_hsh)
    rg.preamp = 0.1
    assert_equal({"preamp" => 0.1}, rg.to_hsh)
    rg.preamp = 0
    assert_equal({}, rg.to_hsh)
  end

  def test_load
    rg = DTAS::RGState.load("preamp" => 0.666)
    assert_equal({"preamp" => 0.666}, rg.to_hsh)
  end

  def test_rg_vol_norm
    rg = DTAS::RGState.new
    assert_nil rg.rg_vol_norm(0.999999999)
    assert_match(%r{\Again 0.827}, rg.rg_vol_norm(0.9))
  end

  def test_mode_set
    rg = DTAS::RGState.new
    orig = rg.mode
    assert_nil DTAS::RGState::RG_DEFAULT["mode"]
    assert_nil orig
    %w(album_gain track_gain album_peak track_peak).each do |t|
      rg.mode = t
      assert_equal t, rg.mode
    end
  end
end

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone git://80x24.org/dtas.git
git clone https://80x24.org/dtas.git