Skip to content

Commit

Permalink
Add the chopsticks code at RubyKaigi2023
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jun 26, 2023
1 parent 94ac77c commit d1b6ff4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/test_trick.rb
Expand Up @@ -214,6 +214,30 @@ def test_03_mame
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
Expand Down

0 comments on commit d1b6ff4

Please sign in to comment.