Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8b856b38ee
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 83 lines (69 sloc) 2.124 kb
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 77 78 79 80 81 82
require 'test_helper'

class AquesTalkTest < Test::Unit::TestCase
context "synthe method" do
    should "return not nil when given hiragana" do
      res, size = AquesTalk.synthe("これわてすとですね?", 70)
      assert_not_nil res
   end

    should "return nil when given english" do
      res, size = AquesTalk.synthe("foo", 70)
      assert_nil res
    end
end

context "free_wave method" do
    should "return nil when given valid data" do
      res, size = AquesTalk.synthe("これわてすとですね?", 70)
      assert_nil AquesTalk.free_wave(res)
   end

should "return nil when given invalid data" do
      res, size = AquesTalk.synthe("bar", 70)
      assert_nil AquesTalk.free_wave(res)
   end
end

context "play_sync method" do
    should "return 0 when given valid message" do
   assert_equal 0, AquesTalk.play_sync("これわてすとですか?", 70)
   end

    should "return not 0 when given invalid message" do
   assert_not_equal 0, AquesTalk.play_sync("bar", 70)
   end
end

should "create method return not nil" do
    assert_not_nil AquesTalk.create
end

should "release method return nil" do
h_me = AquesTalk.create
    assert_nil AquesTalk.release(h_me)
end

  context "play method" do
    should "return 0 when given valid arguments" do
h_me = AquesTalk.create
      assert_equal 0, AquesTalk.play(h_me, "これわてすとですか?")
   end

    should "return not 0 when given invalid arguments" do
h_me = AquesTalk.create
      assert_not_equal 0, AquesTalk.play(h_me, "foo")
   end
  end

should "stop method return nil" do
    h_me = AquesTalk.create
    AquesTalk.play(h_me, "これわてすとですか?")
sleep 1
    assert_nil AquesTalk.stop(h_me)
end

  context "is_play method" do
    should "return 1 when playing" do
      h_me = AquesTalk.create
      AquesTalk.play(h_me, "これわてすとですか?")
sleep 1
      assert_equal 1, AquesTalk.is_play(h_me)
end

    should "return 0 when not playing" do
      h_me = AquesTalk.create
      AquesTalk.play(h_me, "これわてすとですか?")
sleep 1
      AquesTalk.stop(h_me)
      assert_equal 0, AquesTalk.is_play(h_me)
end
end
end
Something went wrong with that request. Please try again.