everything related to duct tape audio suite (dtas)
 help / color / mirror / Atom feed
e3a8d34d8ee9a34bf9112810d69d7994dd5a01d5 blob 2420 bytes (raw)

 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
# Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org>
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
require_relative 'helper'
require 'dtas/tracklist'
class TestTracklist < Testcase
  def test_tl_add_tracks
    tl = DTAS::Tracklist.new
    tl.add_track("/foo.flac")
    assert_equal(%w(/foo.flac), tl.instance_variable_get(:@list))

    oids = tl.tracks
    assert_kind_of Array, oids
    assert_equal 1, oids.size
    assert_equal [ [ oids[0], "/foo.flac" ] ], tl.get_tracks(oids)

    tl.add_track("/bar.flac")
    assert_equal(%w(/bar.flac /foo.flac), tl.instance_variable_get(:@list))

    tl.add_track("/after.flac", oids[0])
    assert_equal(%w(/bar.flac /foo.flac /after.flac),
                 tl.instance_variable_get(:@list))
  end

  def test_add_current
    tl = DTAS::Tracklist.new
    tl.instance_variable_get(:@list).replace(%w(a b c d e f g))
    tl.add_track('/foo.flac', nil, true)
    assert_equal '/foo.flac', tl.cur_track
  end

  def test_advance_track
    tl = DTAS::Tracklist.new
    tl.instance_variable_get(:@list).replace(%w(a b c d e f g))
    %w(a b c d e f g).each do |t|
      assert_equal t, tl.advance_track[0]
    end
    assert_nil tl.advance_track
    tl.repeat = true
    assert_equal 'a', tl.advance_track[0]
  end

  def _build_mapping(tl)
    tracks = tl.get_tracks(tl.tracks)
    Hash[tracks.map { |(oid,name)| [ name, oid ] }]
  end

  def test_goto
    tl = DTAS::Tracklist.new
    tl.instance_variable_get(:@list).replace(%w(a b c d e f g))
    mapping = _build_mapping(tl)
    assert_equal 'f', tl.go_to(mapping['f'])
    assert_equal 'f', tl.advance_track[0]
    assert_nil tl.go_to(1 << 128)
    assert_equal 'g', tl.advance_track[0]
  end

  def test_remove_track
    tl = DTAS::Tracklist.new
    tl.instance_variable_get(:@list).replace(%w(a b c d e f g))
    mapping = _build_mapping(tl)
    %w(a b c d e f g).each { |t| assert_kind_of Integer, mapping[t] }

    tl.remove_track(mapping['a'])
    assert_equal %w(b c d e f g), tl.instance_variable_get(:@list)

    tl.remove_track(mapping['d'])
    assert_equal %w(b c e f g), tl.instance_variable_get(:@list)

    tl.remove_track(mapping['g'])
    assert_equal %w(b c e f), tl.instance_variable_get(:@list)

    # it'll be a while before OIDs require >128 bits, right?
    tl.remove_track(1 << 128)
    assert_equal %w(b c e f), tl.instance_variable_get(:@list), "no change"
  end
end
debug log:

solving e3a8d34 ...
found e3a8d34 in https://80x24.org/dtas.git

everything related to duct tape audio suite (dtas)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://80x24.org/dtas-all
	git clone --mirror http://ou63pmih66umazou.onion/dtas-all

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 dtas-all dtas-all/ https://80x24.org/dtas-all \
		dtas-all@nongnu.org
	public-inbox-index dtas-all

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.dtas
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	dtas.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git