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.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +13 -2
  3. data/fOOrth.gemspec +2 -2
  4. data/integration/array_lib_tests.rb +10 -0
  5. data/integration/exception_lib_tests.rb +4 -0
  6. data/integration/hash_lib_tests.rb +9 -0
  7. data/integration/numeric_lib_tests.rb +326 -321
  8. data/integration/procedure_lib_tests.rb +16 -0
  9. data/integration/queue_lib_tests.rb +2 -1
  10. data/integration/stack_lib_tests.rb +2 -1
  11. data/integration/string_lib_tests.rb +11 -0
  12. data/integration/thread_lib_tests.rb +11 -8
  13. data/lib/fOOrth/compiler/context.rb +64 -64
  14. data/lib/fOOrth/compiler/context/locals.rb +34 -34
  15. data/lib/fOOrth/compiler/context/map_name.rb +85 -85
  16. data/lib/fOOrth/compiler/context/tags.rb +60 -48
  17. data/lib/fOOrth/compiler/process/procedure.rb +40 -0
  18. data/lib/fOOrth/library.rb +1 -0
  19. data/lib/fOOrth/library/array_library.rb +41 -21
  20. data/lib/fOOrth/library/command_library.rb +1 -1
  21. data/lib/fOOrth/library/compile_library.rb +266 -266
  22. data/lib/fOOrth/library/complex_library.rb +82 -80
  23. data/lib/fOOrth/library/float_library.rb +37 -0
  24. data/lib/fOOrth/library/hash_library.rb +14 -6
  25. data/lib/fOOrth/library/mutex_library.rb +4 -2
  26. data/lib/fOOrth/library/numeric_library.rb +359 -380
  27. data/lib/fOOrth/library/procedure_library.rb +69 -65
  28. data/lib/fOOrth/library/queue_library.rb +6 -1
  29. data/lib/fOOrth/library/rational_library.rb +89 -89
  30. data/lib/fOOrth/library/stack_library.rb +6 -1
  31. data/lib/fOOrth/library/string_library.rb +18 -6
  32. data/lib/fOOrth/monkey_patch/exceptions.rb +2 -6
  33. data/lib/fOOrth/version.rb +1 -1
  34. data/tests/compiler/context_tests.rb +188 -177
  35. data/tests/compiler/file_source_tests.rb +130 -130
  36. data/tests/compiler/parser_tests.rb +4 -4
  37. data/tests/compiler/string_source_tests.rb +4 -4
  38. data/tests/core_tests.rb +138 -138
  39. data/tests/monkey_patch/complex_test.rb +24 -24
  40. data/tests/monkey_patch/object_test.rb +49 -49
  41. data/tests/monkey_patch/string_test.rb +61 -61
  42. 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
- assert_equal(nil, comp.to_foorth_r)
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
- assert_equal(obj.to_foorth_n, nil)
36
- end
37
-
38
- #Test for conversion to a rational.
39
- def test_to_rational
40
- obj = Object.new
41
- assert_equal(obj.to_foorth_r, nil)
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
- assert_equal(''.to_foorth_c, nil)
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_equal('fubar'.to_foorth_n, nil)
43
- assert_equal('2cats'.to_foorth_n, nil)
44
- end
45
-
46
- def test_to_rational
47
- assert_equal(Rational(1,2), '1/2'.to_foorth_r)
48
- assert_equal(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
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.10
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: 2018-07-20 00:00:00.000000000 Z
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: '1.3'
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: '1.3'
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: '0'
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: '0'
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
- rubyforge_project:
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.