diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-06-26 13:49:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2023-06-26 13:52:07 +0900 |
commit | d1b6ff42fa0c7345713ec5e40c9cd782dac88948 (patch) | |
tree | 1bf7b8fbf4076b335c9f8c4ea62d6183b080781a /test | |
parent | 94ac77c955c21d4f99e36524e4ecde233cd844e0 (diff) |
Add the chopsticks code at RubyKaigi2023
Diffstat (limited to 'test')
-rw-r--r-- | test/test_trick.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_trick.rb b/test/test_trick.rb index 201dd50b9b..f0e7eb23b7 100644 --- a/test/test_trick.rb +++ b/test/test_trick.rb @@ -214,6 +214,30 @@ class TestTRICK2022 < Test::Unit::TestCase end end +class TestRubyKaigi2023🥢 < Test::Unit::TestCase + CHOPSTICKS = [<<~'0', <<~'1'] # by mame + BEGIN{q=:Ruby};p||=:Enjoy;END{puts p,q||2023} + 0 + q=print(q||"/:|}\n")||p&&:@Matsumoto;p=:Kaigi + 1 + + def test_chopsticks_0 + assert_in_out_err([], CHOPSTICKS[0], %w[Enjoy Ruby]) + end + + def test_chopsticks_1 + assert_in_out_err([], CHOPSTICKS[1], %w[/:|}]) + end + + def test_chopsticks_0_1 + assert_in_out_err([], "#{CHOPSTICKS[0]}\n#{CHOPSTICKS[1]}", %w[RubyKaigi @Matsumoto]) + end + + def test_chopsticks_1_0 + assert_in_out_err([], "#{CHOPSTICKS[1]}\n#{CHOPSTICKS[0]}", %w[RubyKaigi 2023]) + end +end + # https://github.com/mame/all-ruby-quine class TestAllRubyQuine < Test::Unit::TestCase def test_all_ruby_quine |