<commit_before>class TestElement < Test::Unit::TestCase
  include GstTestUtils

  class TestBin < Gst::Bin
    type_register
  end


  def test_clock
    bin = create_element("playbin")
    assert(bin.require_clock?)
    assert(bin.provide_clock?)
    assert_nil(bin.clock)
  end

  def test_each_pad
    pads = []
    create_element("filesrc").each_pad do |pad|
      pads << pad.name
    end
    assert_equal(["src"], pads)
  end

  def test_state
    pipeline = Gst::Pipeline.new
    src = create_element("videotestsrc")
    sink = create_element("fakesink")
    pipeline.add(src, sink)

    assert_equal([Gst::STATE_CHANGE_SUCCESS,
                  Gst::STATE_NULL,
                  Gst::STATE_VOID_PENDING],
                 pipeline.get_state)

    pipeline.ready
    assert_equal([Gst::STATE_CHANGE_SUCCESS,
                  Gst::STATE_READY,
                  Gst::STATE_VOID_PENDING],
                 pipeline.get_state)

    pipeline.play
    assert_equal([Gst::STATE_CHANGE_FAILURE,
                  Gst::STATE_READY,
                  Gst::STATE_PLAYING],
                 pipeline.get_state(1000))

    pipeline.pause
    assert_equal([Gst::STATE_CHANGE_ASYNC,
                  Gst::STATE_READY,
                  Gst::STATE_PAUSED],
                 pipeline.get_state(10))

    pipeline.stop
    assert_equal([Gst::STATE_CHANGE_SUCCESS,
                  Gst::STATE_NULL,
                  Gst::STATE_VOID_PENDING],
                 pipeline.get_state(1000))

    pipeline.set_state(:playing)
    assert_equal([Gst::STATE_CHANGE_FAILURE,
                  Gst::STATE_READY,
                  Gst::STATE_PLAYING],
                 pipeline.get_state(1000))
  end

  def test_query
    pipeline = Gst::Pipeline.new
    assert_boolean(pipeline.query(Gst::QueryFormats.new))
  end
<commit_msg>[gstreamer][test] don't use async get_state.<commit_after>class TestElement < Test::Unit::TestCase
  include GstTestUtils

  class TestBin < Gst::Bin
    type_register
  end


  def test_clock
    bin = create_element("playbin")
    assert(bin.require_clock?)
    assert(bin.provide_clock?)
    assert_nil(bin.clock)
  end

  def test_each_pad
    pads = []
    create_element("filesrc").each_pad do |pad|
      pads << pad.name
    end
    assert_equal(["src"], pads)
  end

  def test_state
    pipeline = Gst::Pipeline.new
    src = create_element("fakesrc")
    sink = create_element("fakesink")
    pipeline.add(src, sink)

    assert_equal([Gst::STATE_CHANGE_SUCCESS,
                  Gst::STATE_NULL,
                  Gst::STATE_VOID_PENDING],
                 pipeline.get_state)

    pipeline.ready
    assert_equal([Gst::STATE_CHANGE_SUCCESS,
                  Gst::STATE_READY,
                  Gst::STATE_VOID_PENDING],
                 pipeline.get_state)

    pipeline.play
    assert_equal([Gst::STATE_CHANGE_FAILURE,
                  Gst::STATE_READY,
                  Gst::STATE_PLAYING],
                 pipeline.get_state)

    pipeline.pause
    assert_equal([Gst::STATE_CHANGE_ASYNC,
                  Gst::STATE_READY,
                  Gst::STATE_PAUSED],
                 pipeline.get_state(1))

    pipeline.stop
    assert_equal([Gst::STATE_CHANGE_SUCCESS,
                  Gst::STATE_NULL,
                  Gst::STATE_VOID_PENDING],
                 pipeline.get_state)

    pipeline.set_state(:playing)
    assert_equal([Gst::STATE_CHANGE_FAILURE,
                  Gst::STATE_READY,
                  Gst::STATE_PLAYING],
                 pipeline.get_state)
  end

  def test_query
    pipeline = Gst::Pipeline.new
    assert_boolean(pipeline.query(Gst::QueryFormats.new))
  end

{'fraction_non_alphanumeric': 0.09760132340777503, 'fraction_numerical': 0.0041356492969396195, 'mean_word_length': 2.1713286713286712, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6694235', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1150, 'n_words': 156}