fOOrth 0.6.10 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +13 -2
- data/fOOrth.gemspec +2 -2
- data/integration/array_lib_tests.rb +10 -0
- data/integration/exception_lib_tests.rb +4 -0
- data/integration/hash_lib_tests.rb +9 -0
- data/integration/numeric_lib_tests.rb +326 -321
- data/integration/procedure_lib_tests.rb +16 -0
- data/integration/queue_lib_tests.rb +2 -1
- data/integration/stack_lib_tests.rb +2 -1
- data/integration/string_lib_tests.rb +11 -0
- data/integration/thread_lib_tests.rb +11 -8
- data/lib/fOOrth/compiler/context.rb +64 -64
- data/lib/fOOrth/compiler/context/locals.rb +34 -34
- data/lib/fOOrth/compiler/context/map_name.rb +85 -85
- data/lib/fOOrth/compiler/context/tags.rb +60 -48
- data/lib/fOOrth/compiler/process/procedure.rb +40 -0
- data/lib/fOOrth/library.rb +1 -0
- data/lib/fOOrth/library/array_library.rb +41 -21
- data/lib/fOOrth/library/command_library.rb +1 -1
- data/lib/fOOrth/library/compile_library.rb +266 -266
- data/lib/fOOrth/library/complex_library.rb +82 -80
- data/lib/fOOrth/library/float_library.rb +37 -0
- data/lib/fOOrth/library/hash_library.rb +14 -6
- data/lib/fOOrth/library/mutex_library.rb +4 -2
- data/lib/fOOrth/library/numeric_library.rb +359 -380
- data/lib/fOOrth/library/procedure_library.rb +69 -65
- data/lib/fOOrth/library/queue_library.rb +6 -1
- data/lib/fOOrth/library/rational_library.rb +89 -89
- data/lib/fOOrth/library/stack_library.rb +6 -1
- data/lib/fOOrth/library/string_library.rb +18 -6
- data/lib/fOOrth/monkey_patch/exceptions.rb +2 -6
- data/lib/fOOrth/version.rb +1 -1
- data/tests/compiler/context_tests.rb +188 -177
- data/tests/compiler/file_source_tests.rb +130 -130
- data/tests/compiler/parser_tests.rb +4 -4
- data/tests/compiler/string_source_tests.rb +4 -4
- data/tests/core_tests.rb +138 -138
- data/tests/monkey_patch/complex_test.rb +24 -24
- data/tests/monkey_patch/object_test.rb +49 -49
- data/tests/monkey_patch/string_test.rb +61 -61
- metadata +10 -10
@@ -1,25 +1,25 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative '../../lib/fOOrth/monkey_patch/numeric'
|
4
|
-
require_relative '../../lib/fOOrth/monkey_patch/complex'
|
5
|
-
gem 'minitest'
|
6
|
-
require 'minitest/autorun'
|
7
|
-
require 'minitest_visible'
|
8
|
-
|
9
|
-
#Test the monkey patches applied to the Object class.
|
10
|
-
class ComplexMonkeyPatchTester < Minitest::Test
|
11
|
-
|
12
|
-
#Track mini-test progress.
|
13
|
-
include MinitestVisible
|
14
|
-
|
15
|
-
#Test that it embeds
|
16
|
-
def test_foorth_embed
|
17
|
-
comp = Complex(1,2)
|
18
|
-
assert_equal(comp.foorth_embed, 'Complex(1,2)')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_that_it_is_not_rationalizable
|
22
|
-
comp = Complex(1,2)
|
23
|
-
|
24
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../lib/fOOrth/monkey_patch/numeric'
|
4
|
+
require_relative '../../lib/fOOrth/monkey_patch/complex'
|
5
|
+
gem 'minitest'
|
6
|
+
require 'minitest/autorun'
|
7
|
+
require 'minitest_visible'
|
8
|
+
|
9
|
+
#Test the monkey patches applied to the Object class.
|
10
|
+
class ComplexMonkeyPatchTester < Minitest::Test
|
11
|
+
|
12
|
+
#Track mini-test progress.
|
13
|
+
include MinitestVisible
|
14
|
+
|
15
|
+
#Test that it embeds
|
16
|
+
def test_foorth_embed
|
17
|
+
comp = Complex(1,2)
|
18
|
+
assert_equal(comp.foorth_embed, 'Complex(1,2)')
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_that_it_is_not_rationalizable
|
22
|
+
comp = Complex(1,2)
|
23
|
+
assert_nil(comp.to_foorth_r)
|
24
|
+
end
|
25
25
|
end
|
@@ -1,49 +1,49 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative '../../lib/fOOrth/monkey_patch'
|
4
|
-
gem 'minitest'
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'minitest_visible'
|
7
|
-
|
8
|
-
#Test the monkey patches applied to the Object class.
|
9
|
-
class ObjectMonkeyPatchTester < Minitest::Test
|
10
|
-
|
11
|
-
#Track mini-test progress.
|
12
|
-
include MinitestVisible
|
13
|
-
|
14
|
-
#Test that it does NOT foorth_embed.
|
15
|
-
def test_foorth_embed_error
|
16
|
-
obj = Object.new
|
17
|
-
assert_raises(XfOOrth::XfOOrthError) { obj.foorth_embed }
|
18
|
-
end
|
19
|
-
|
20
|
-
#Test for conversion to a boolean.
|
21
|
-
def test_to_boolean
|
22
|
-
obj = Object.new
|
23
|
-
assert_equal(obj.to_foorth_b, true)
|
24
|
-
end
|
25
|
-
|
26
|
-
#Test for conversion to a character.
|
27
|
-
def test_to_character
|
28
|
-
obj = Object.new
|
29
|
-
assert_equal(obj.to_foorth_c, "\x00")
|
30
|
-
end
|
31
|
-
|
32
|
-
#Test for conversion to a number.
|
33
|
-
def test_to_number
|
34
|
-
obj = Object.new
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
#Test for conversion to a rational.
|
39
|
-
def test_to_rational
|
40
|
-
obj = Object.new
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
#Test the quick fail raise in fOOrth.
|
45
|
-
def test_that_exceptions_are_easy_to_raise
|
46
|
-
assert_raises(XfOOrth::XfOOrthError) { error('Failure IS an option!') }
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../lib/fOOrth/monkey_patch'
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'minitest_visible'
|
7
|
+
|
8
|
+
#Test the monkey patches applied to the Object class.
|
9
|
+
class ObjectMonkeyPatchTester < Minitest::Test
|
10
|
+
|
11
|
+
#Track mini-test progress.
|
12
|
+
include MinitestVisible
|
13
|
+
|
14
|
+
#Test that it does NOT foorth_embed.
|
15
|
+
def test_foorth_embed_error
|
16
|
+
obj = Object.new
|
17
|
+
assert_raises(XfOOrth::XfOOrthError) { obj.foorth_embed }
|
18
|
+
end
|
19
|
+
|
20
|
+
#Test for conversion to a boolean.
|
21
|
+
def test_to_boolean
|
22
|
+
obj = Object.new
|
23
|
+
assert_equal(obj.to_foorth_b, true)
|
24
|
+
end
|
25
|
+
|
26
|
+
#Test for conversion to a character.
|
27
|
+
def test_to_character
|
28
|
+
obj = Object.new
|
29
|
+
assert_equal(obj.to_foorth_c, "\x00")
|
30
|
+
end
|
31
|
+
|
32
|
+
#Test for conversion to a number.
|
33
|
+
def test_to_number
|
34
|
+
obj = Object.new
|
35
|
+
assert_nil(obj.to_foorth_n)
|
36
|
+
end
|
37
|
+
|
38
|
+
#Test for conversion to a rational.
|
39
|
+
def test_to_rational
|
40
|
+
obj = Object.new
|
41
|
+
assert_nil(obj.to_foorth_r)
|
42
|
+
end
|
43
|
+
|
44
|
+
#Test the quick fail raise in fOOrth.
|
45
|
+
def test_that_exceptions_are_easy_to_raise
|
46
|
+
assert_raises(XfOOrth::XfOOrthError) { error('Failure IS an option!') }
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -1,61 +1,61 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative '../../lib/fOOrth/monkey_patch/string'
|
4
|
-
gem 'minitest'
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'minitest_visible'
|
7
|
-
|
8
|
-
#Test the monkey patches applied to the Object class.
|
9
|
-
class StringMonkeyPatchTester < Minitest::Test
|
10
|
-
|
11
|
-
#Track mini-test progress.
|
12
|
-
include MinitestVisible
|
13
|
-
|
14
|
-
#Test that it embeds
|
15
|
-
def test_foorth_embed
|
16
|
-
assert_equal("A big blue cat".foorth_embed, "\"A big blue cat\"")
|
17
|
-
assert_equal("The cat's toy".foorth_embed, "\"The cat's toy\"")
|
18
|
-
assert_equal('A dog\cat race'.foorth_embed, "\"A dog\\\\cat race\"")
|
19
|
-
assert_equal('A dog/cat race'.foorth_embed, "\"A dog/cat race\"")
|
20
|
-
end
|
21
|
-
|
22
|
-
#Test converting to a character.
|
23
|
-
def test_to_character
|
24
|
-
assert_equal('ABC'.to_foorth_c, 'A')
|
25
|
-
assert_equal('A'.to_foorth_c, 'A')
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
#Test converting to a number.
|
30
|
-
def test_to_number
|
31
|
-
assert_equal('123'.to_foorth_n, 123)
|
32
|
-
assert_equal('123.4'.to_foorth_n, 123.4)
|
33
|
-
assert_equal('1/2'.to_foorth_n, '1/2'.to_r)
|
34
|
-
assert_equal('1+2i'.to_foorth_n, Complex(1,2))
|
35
|
-
assert_equal('2i'.to_foorth_n, Complex(0,2))
|
36
|
-
assert_equal('1-2i'.to_foorth_n, Complex(1,-2))
|
37
|
-
assert_equal('-2i'.to_foorth_n, Complex(0,-2))
|
38
|
-
assert_equal('+1+2i'.to_foorth_n, Complex(1,2))
|
39
|
-
assert_equal('+2i'.to_foorth_n, Complex(0,2))
|
40
|
-
assert_equal('+1-2i'.to_foorth_n, Complex(1,-2))
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_to_rational
|
47
|
-
assert_equal(Rational(1,2), '1/2'.to_foorth_r)
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_clone_patches
|
52
|
-
s = "abc"
|
53
|
-
assert_equal(s.object_id, s.safe_clone.object_id)
|
54
|
-
assert_equal(s.object_id, s.full_clone.object_id)
|
55
|
-
|
56
|
-
b = StringBuffer.new('abc')
|
57
|
-
refute_equal(b.object_id, b.safe_clone.object_id)
|
58
|
-
refute_equal(b.object_id, b.full_clone.object_id)
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../lib/fOOrth/monkey_patch/string'
|
4
|
+
gem 'minitest'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'minitest_visible'
|
7
|
+
|
8
|
+
#Test the monkey patches applied to the Object class.
|
9
|
+
class StringMonkeyPatchTester < Minitest::Test
|
10
|
+
|
11
|
+
#Track mini-test progress.
|
12
|
+
include MinitestVisible
|
13
|
+
|
14
|
+
#Test that it embeds
|
15
|
+
def test_foorth_embed
|
16
|
+
assert_equal("A big blue cat".foorth_embed, "\"A big blue cat\"")
|
17
|
+
assert_equal("The cat's toy".foorth_embed, "\"The cat's toy\"")
|
18
|
+
assert_equal('A dog\cat race'.foorth_embed, "\"A dog\\\\cat race\"")
|
19
|
+
assert_equal('A dog/cat race'.foorth_embed, "\"A dog/cat race\"")
|
20
|
+
end
|
21
|
+
|
22
|
+
#Test converting to a character.
|
23
|
+
def test_to_character
|
24
|
+
assert_equal('ABC'.to_foorth_c, 'A')
|
25
|
+
assert_equal('A'.to_foorth_c, 'A')
|
26
|
+
assert_nil(''.to_foorth_c)
|
27
|
+
end
|
28
|
+
|
29
|
+
#Test converting to a number.
|
30
|
+
def test_to_number
|
31
|
+
assert_equal('123'.to_foorth_n, 123)
|
32
|
+
assert_equal('123.4'.to_foorth_n, 123.4)
|
33
|
+
assert_equal('1/2'.to_foorth_n, '1/2'.to_r)
|
34
|
+
assert_equal('1+2i'.to_foorth_n, Complex(1,2))
|
35
|
+
assert_equal('2i'.to_foorth_n, Complex(0,2))
|
36
|
+
assert_equal('1-2i'.to_foorth_n, Complex(1,-2))
|
37
|
+
assert_equal('-2i'.to_foorth_n, Complex(0,-2))
|
38
|
+
assert_equal('+1+2i'.to_foorth_n, Complex(1,2))
|
39
|
+
assert_equal('+2i'.to_foorth_n, Complex(0,2))
|
40
|
+
assert_equal('+1-2i'.to_foorth_n, Complex(1,-2))
|
41
|
+
|
42
|
+
assert_nil('fubar'.to_foorth_n)
|
43
|
+
assert_nil('2cats'.to_foorth_n)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_to_rational
|
47
|
+
assert_equal(Rational(1,2), '1/2'.to_foorth_r)
|
48
|
+
assert_nil('apple'.to_foorth_r)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_clone_patches
|
52
|
+
s = "abc"
|
53
|
+
assert_equal(s.object_id, s.safe_clone.object_id)
|
54
|
+
assert_equal(s.object_id, s.full_clone.object_id)
|
55
|
+
|
56
|
+
b = StringBuffer.new('abc')
|
57
|
+
refute_equal(b.object_id, b.safe_clone.object_id)
|
58
|
+
refute_equal(b.object_id, b.full_clone.object_id)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fOOrth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.1.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: reek
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,6 +283,7 @@ files:
|
|
283
283
|
- lib/fOOrth/library/duration/make.rb
|
284
284
|
- lib/fOOrth/library/duration_library.rb
|
285
285
|
- lib/fOOrth/library/fiber_library.rb
|
286
|
+
- lib/fOOrth/library/float_library.rb
|
286
287
|
- lib/fOOrth/library/formatting/array.rb
|
287
288
|
- lib/fOOrth/library/formatting/bullets.rb
|
288
289
|
- lib/fOOrth/library/formatting/columns.rb
|
@@ -376,8 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
377
|
- !ruby/object:Gem::Version
|
377
378
|
version: '0'
|
378
379
|
requirements: []
|
379
|
-
|
380
|
-
rubygems_version: 2.5.2
|
380
|
+
rubygems_version: 3.2.17
|
381
381
|
signing_key:
|
382
382
|
specification_version: 4
|
383
383
|
summary: FNF == fOOrth is Not FORTH.
|