switch from test-unit to minitest

This commit is contained in:
Gwenhael Le Moine 2022-02-17 15:09:29 +01:00
parent 9480c49272
commit 7fce85d694
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
12 changed files with 29 additions and 28 deletions

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestParser < Test::Unit::TestCase
class TestParser < MiniTest::Test
def test_stack_extract
interpreter = Rpl.new( [{ value: 1, type: :numeric },
{ value: 2, type: :numeric }] )

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageBranch < Test::Unit::TestCase
class TestLanguageBranch < MiniTest::Test
def test_loop
interpreter = Rpl.new
interpreter.run '« "hello no." swap + » 11 16 loop'

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageFileSystem < Test::Unit::TestCase
class TestLanguageFileSystem < MiniTest::Test
def test_fread
interpreter = Rpl.new
interpreter.run '"spec/test.rpl" fread'
@ -39,7 +39,8 @@ trrr
assert_equal [],
interpreter.stack
assert_true File.exist?( 'spec/test_fwrite.txt' )
assert_equal true,
File.exist?( 'spec/test_fwrite.txt' )
written_content = File.read( 'spec/test_fwrite.txt' )
assert_equal 'Ceci est un test de fwrite',

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TesttLanguageOperations < Test::Unit::TestCase
class TesttLanguageOperations < MiniTest::Test
def test_add
interpreter = Rpl.new
interpreter.run '1 2 +'

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageProgram < Test::Unit::TestCase
class TestLanguageProgram < MiniTest::Test
def test_eval
interpreter = Rpl.new
interpreter.run '« 2 dup * dup » eval'

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageStack < Test::Unit::TestCase
class TestLanguageStack < MiniTest::Test
def test_swap
interpreter = Rpl.new
interpreter.run '1 2 swap'

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageProgram < Test::Unit::TestCase
class TestLanguageProgram < MiniTest::Test
def test_sto
interpreter = Rpl.new
interpreter.run '« 2 dup * » \'quatre\' sto'

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageString < Test::Unit::TestCase
class TestLanguageString < MiniTest::Test
def test_to_string
interpreter = Rpl.new
interpreter.run '2 →str'

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageTest < Test::Unit::TestCase
class TestLanguageTest < MiniTest::Test
def test_greater_than
interpreter = Rpl.new
interpreter.run '0 0.1 >'

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestLanguageTimeDate < Test::Unit::TestCase
class TestLanguageTimeDate < MiniTest::Test
def test_time
now = Time.now.to_s
interpreter = Rpl.new

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TesttLanguageOperations < Test::Unit::TestCase
class TesttLanguageOperations < MiniTest::Test
def test_pi
interpreter = Rpl.new
interpreter.run 'pi'
@ -55,7 +55,7 @@ class TesttLanguageOperations < Test::Unit::TestCase
interpreter.stack
end
def test_dr
def test_d2r
interpreter = Rpl.new
interpreter.run '90 d→r'
assert_equal [{ value: BigMath.PI( interpreter.precision ) / 2,
@ -63,10 +63,10 @@ class TesttLanguageOperations < Test::Unit::TestCase
interpreter.stack
end
def test_rd
def test_r2d
interpreter = Rpl.new
interpreter.run 'pi r→d'
assert_equal [{ value: 180, type: :numeric, base: 10 }],
assert_equal [{ value: BigDecimal( 180 ), type: :numeric, base: 10 }],
interpreter.stack
end
end

View file

@ -1,11 +1,11 @@
# coding: utf-8
# frozen_string_literal: true
require 'test/unit'
require 'minitest/autorun'
require 'rpl'
class TestParser < Test::Unit::TestCase
class TestParser < MiniTest::Test
def test_number
result = Rpl.new.parse( '1' )
assert_equal [{ value: 1, type: :numeric, base: 10 }], result