Sha256: 1e57318c6e358d851cf16f832853c7f7ec95867a3b818eceb160ded994ebf67f

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

# frozen-string-literal: true

module Bioshogi
  module Assertion
    extend self

    def assert(actual = nil, message = nil, &block)
      if block_given?
        actual = yield
      end
      unless actual
        message ||= "assert failed"
        raise MustNotHappen, "#{message}: #{actual.inspect}"
      end
    end

    def assert_equal(expected, actual, message = nil)
      if expected != actual
        message ||= "assert_equal failed"
        raise MustNotHappen, "#{message}: #{expected.inspect} != #{actual.inspect}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bioshogi-0.0.15 lib/bioshogi/assertion.rb
bioshogi-0.0.14 lib/bioshogi/assertion.rb