kuniri 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +43 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +18 -0
  5. data/.yardopts +1 -0
  6. data/COPYING +661 -0
  7. data/Gemfile +14 -0
  8. data/Guardfile +8 -0
  9. data/README.md +102 -0
  10. data/Rakefile +114 -0
  11. data/bin/kuniri +53 -0
  12. data/data/attribute_lang.rb +131 -0
  13. data/data/class_lang.rb +77 -0
  14. data/data/conditional_lang.rb +71 -0
  15. data/data/constructor_lang.rb +34 -0
  16. data/data/end_block_lang.rb +30 -0
  17. data/data/extern_requirement_lang.rb +45 -0
  18. data/data/function_behavior_lang.rb +113 -0
  19. data/data/lang_syntax.rb +111 -0
  20. data/data/module_namespace_lang.rb +43 -0
  21. data/data/repetition_lang.rb +62 -0
  22. data/data/token_lang.rb +55 -0
  23. data/data/variable_global_lang.rb +118 -0
  24. data/kuniri.gemspec +24 -0
  25. data/lib/kuniri/core/configuration/language_available.rb +7 -0
  26. data/lib/kuniri/core/configuration/log_available.rb +7 -0
  27. data/lib/kuniri/core/configuration/monitor_available.rb +13 -0
  28. data/lib/kuniri/core/kuniri.rb +78 -0
  29. data/lib/kuniri/core/setting.rb +143 -0
  30. data/lib/kuniri/error/configuration_file_error.rb +12 -0
  31. data/lib/kuniri/error/language_error.rb +12 -0
  32. data/lib/kuniri/language/abstract_container/structured_and_oo/attribute.rb +73 -0
  33. data/lib/kuniri/language/abstract_container/structured_and_oo/class.rb +51 -0
  34. data/lib/kuniri/language/abstract_container/structured_and_oo/comment.rb +57 -0
  35. data/lib/kuniri/language/abstract_container/structured_and_oo/conditional.rb +42 -0
  36. data/lib/kuniri/language/abstract_container/structured_and_oo/constructor.rb +52 -0
  37. data/lib/kuniri/language/abstract_container/structured_and_oo/end_block.rb +27 -0
  38. data/lib/kuniri/language/abstract_container/structured_and_oo/extern_requirement.rb +36 -0
  39. data/lib/kuniri/language/abstract_container/structured_and_oo/function_behavior.rb +55 -0
  40. data/lib/kuniri/language/abstract_container/structured_and_oo/module_namespace.rb +36 -0
  41. data/lib/kuniri/language/abstract_container/structured_and_oo/repetition.rb +42 -0
  42. data/lib/kuniri/language/abstract_container/structured_and_oo/variable_behaviour.rb +53 -0
  43. data/lib/kuniri/language/abstract_container/structured_and_oo/variable_global.rb +67 -0
  44. data/lib/kuniri/language/container_data/structured_and_oo/attribute_data.rb +26 -0
  45. data/lib/kuniri/language/container_data/structured_and_oo/basic_data.rb +18 -0
  46. data/lib/kuniri/language/container_data/structured_and_oo/class_data.rb +77 -0
  47. data/lib/kuniri/language/container_data/structured_and_oo/conditional_data.rb +23 -0
  48. data/lib/kuniri/language/container_data/structured_and_oo/constructor_data.rb +18 -0
  49. data/lib/kuniri/language/container_data/structured_and_oo/extern_requirement_data.rb +26 -0
  50. data/lib/kuniri/language/container_data/structured_and_oo/file_element.rb +77 -0
  51. data/lib/kuniri/language/container_data/structured_and_oo/function_abstract.rb +52 -0
  52. data/lib/kuniri/language/container_data/structured_and_oo/function_data.rb +21 -0
  53. data/lib/kuniri/language/container_data/structured_and_oo/method_data.rb +20 -0
  54. data/lib/kuniri/language/container_data/structured_and_oo/module_namespace_data.rb +18 -0
  55. data/lib/kuniri/language/container_data/structured_and_oo/repetition_data.rb +23 -0
  56. data/lib/kuniri/language/container_data/structured_and_oo/variable_global_data.rb +22 -0
  57. data/lib/kuniri/language/language.rb +222 -0
  58. data/lib/kuniri/language/language_factory.rb +48 -0
  59. data/lib/kuniri/language/ruby/attribute_ruby.rb +134 -0
  60. data/lib/kuniri/language/ruby/class_ruby.rb +83 -0
  61. data/lib/kuniri/language/ruby/comment_ruby.rb +84 -0
  62. data/lib/kuniri/language/ruby/conditional_ruby.rb +77 -0
  63. data/lib/kuniri/language/ruby/constructor_ruby.rb +36 -0
  64. data/lib/kuniri/language/ruby/end_block_ruby.rb +33 -0
  65. data/lib/kuniri/language/ruby/extern_requirement_ruby.rb +49 -0
  66. data/lib/kuniri/language/ruby/function_behavior_ruby.rb +120 -0
  67. data/lib/kuniri/language/ruby/module_namespace_ruby.rb +47 -0
  68. data/lib/kuniri/language/ruby/repetition_ruby.rb +68 -0
  69. data/lib/kuniri/language/ruby/ruby_syntax.rb +117 -0
  70. data/lib/kuniri/language/ruby/token_ruby.rb +59 -0
  71. data/lib/kuniri/language/ruby/variable_behaviour_ruby.rb +83 -0
  72. data/lib/kuniri/language/ruby/variable_global_ruby.rb +123 -0
  73. data/lib/kuniri/parser/parser.rb +45 -0
  74. data/lib/kuniri/parser/parser_xml.rb +128 -0
  75. data/lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb +51 -0
  76. data/lib/kuniri/state_machine/OO_structured_fsm/class_state.rb +94 -0
  77. data/lib/kuniri/state_machine/OO_structured_fsm/comment_state.rb +76 -0
  78. data/lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb +92 -0
  79. data/lib/kuniri/state_machine/OO_structured_fsm/constructor_state.rb +71 -0
  80. data/lib/kuniri/state_machine/OO_structured_fsm/function_state.rb +82 -0
  81. data/lib/kuniri/state_machine/OO_structured_fsm/idle_state.rb +80 -0
  82. data/lib/kuniri/state_machine/OO_structured_fsm/include_state.rb +59 -0
  83. data/lib/kuniri/state_machine/OO_structured_fsm/method_state.rb +69 -0
  84. data/lib/kuniri/state_machine/OO_structured_fsm/module_state.rb +79 -0
  85. data/lib/kuniri/state_machine/OO_structured_fsm/oo_structured_state.rb +92 -0
  86. data/lib/kuniri/state_machine/OO_structured_fsm/repetition_state.rb +85 -0
  87. data/lib/kuniri/state_machine/OO_structured_fsm/token_state_machine.rb +8 -0
  88. data/lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb +49 -0
  89. data/lib/kuniri/util/html_logger.rb +41 -0
  90. data/lib/kuniri/util/logger.rb +34 -0
  91. data/lib/kuniri/util/txt_logger.rb +29 -0
  92. data/lib/kuniri/version.rb +3 -0
  93. data/lib/kuniri.rb +5 -0
  94. data/other/analyseFile.asta +0 -0
  95. data/spec/core/kuniri_spec.rb +14 -0
  96. data/spec/core/setting_spec.rb +114 -0
  97. data/spec/language/abstract_container/attribute_spec.rb +13 -0
  98. data/spec/language/abstract_container/class_spec.rb +13 -0
  99. data/spec/language/abstract_container/comment_spec.rb +31 -0
  100. data/spec/language/abstract_container/conditional_spec.rb +13 -0
  101. data/spec/language/abstract_container/constructor_spec.rb +13 -0
  102. data/spec/language/abstract_container/end_block_spec.rb +14 -0
  103. data/spec/language/abstract_container/module_namespace_spec.rb +13 -0
  104. data/spec/language/abstract_container/repetition_spec.rb +13 -0
  105. data/spec/language/container_data/structured_and_oo/attribute_data_spec.rb +32 -0
  106. data/spec/language/container_data/structured_and_oo/class_data_spec.rb +121 -0
  107. data/spec/language/container_data/structured_and_oo/conditional_data_spec.rb +34 -0
  108. data/spec/language/container_data/structured_and_oo/constructor_data_spec.rb +46 -0
  109. data/spec/language/container_data/structured_and_oo/extern_requirement_data_spec.rb +26 -0
  110. data/spec/language/container_data/structured_and_oo/file_element_spec.rb +91 -0
  111. data/spec/language/container_data/structured_and_oo/function_data_spec.rb +22 -0
  112. data/spec/language/container_data/structured_and_oo/module_namespace_spec.rb +20 -0
  113. data/spec/language/container_data/structured_and_oo/repetition_data_spec.rb +34 -0
  114. data/spec/language/container_data/structured_and_oo/variable_global_data_spec.rb +39 -0
  115. data/spec/language/language_factory_spec.rb +64 -0
  116. data/spec/language/language_spec.rb +74 -0
  117. data/spec/language/ruby/attribute_ruby_spec.rb +126 -0
  118. data/spec/language/ruby/class_ruby_spec.rb +102 -0
  119. data/spec/language/ruby/comment_ruby_spec.rb +78 -0
  120. data/spec/language/ruby/conditional_ruby_spec.rb +106 -0
  121. data/spec/language/ruby/constructor_ruby_spec.rb +57 -0
  122. data/spec/language/ruby/end_block_ruby_spec.rb +62 -0
  123. data/spec/language/ruby/function_behavior_ruby_spec.rb +246 -0
  124. data/spec/language/ruby/module_namespace_ruby_spec.rb +55 -0
  125. data/spec/language/ruby/repetition_ruby_spec.rb +33 -0
  126. data/spec/language/ruby/ruby_syntax_spec.rb +482 -0
  127. data/spec/language/ruby/variable_ruby_spec.rb +134 -0
  128. data/spec/parser/parser_spec.rb +25 -0
  129. data/spec/samples/rubySyntaxParts/attribute/simpleAttribute.rb +15 -0
  130. data/spec/samples/rubySyntaxParts/class/simpleClass.rb +19 -0
  131. data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_class.rb +33 -0
  132. data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_global.rb +20 -0
  133. data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_class.rb +23 -0
  134. data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_global.rb +16 -0
  135. data/spec/samples/rubySyntaxParts/conditionalStatment/constructorConditional.rb +28 -0
  136. data/spec/samples/rubySyntaxParts/conditionalStatment/methodConditional.rb +42 -0
  137. data/spec/samples/rubySyntaxParts/conditionalStatment/nestedConditional.rb +0 -0
  138. data/spec/samples/rubySyntaxParts/conditionalStatment/simpleConditional.rb +43 -0
  139. data/spec/samples/rubySyntaxParts/constructor/simpleConstructor.rb +27 -0
  140. data/spec/samples/rubySyntaxParts/extern/multipleLineExternRequirement.rb +0 -0
  141. data/spec/samples/rubySyntaxParts/extern/requireRelative.rb +6 -0
  142. data/spec/samples/rubySyntaxParts/extern/simpleExternRequirement.rb +14 -0
  143. data/spec/samples/rubySyntaxParts/fullCode/simpleCodeWithConditional.rb +18 -0
  144. data/spec/samples/rubySyntaxParts/fullCode/simpleFullCode.rb +19 -0
  145. data/spec/samples/rubySyntaxParts/function/simpleFunction.rb +29 -0
  146. data/spec/samples/rubySyntaxParts/method/simpleMethod.rb +13 -0
  147. data/spec/samples/rubySyntaxParts/module/simpleModule.rb +12 -0
  148. data/spec/samples/rubySyntaxParts/repetition/simpleRepetition.rb +28 -0
  149. data/spec/samples/rubySyntaxParts/variable/simpleVariable.rb +13 -0
  150. data/spec/spec_helper.rb +20 -0
  151. data/spec/state_machine/OO_structured_fsm/attribute_state_spec.rb +44 -0
  152. data/spec/state_machine/OO_structured_fsm/class_state_spec.rb +90 -0
  153. data/spec/state_machine/OO_structured_fsm/comment_state_spec.rb +30 -0
  154. data/spec/state_machine/OO_structured_fsm/conditional_state_spec.rb +83 -0
  155. data/spec/state_machine/OO_structured_fsm/constructor_state_spec.rb +48 -0
  156. data/spec/state_machine/OO_structured_fsm/function_state_spec.rb +41 -0
  157. data/spec/state_machine/OO_structured_fsm/idle_state_spec.rb +101 -0
  158. data/spec/state_machine/OO_structured_fsm/include_state_spec.rb +62 -0
  159. data/spec/state_machine/OO_structured_fsm/method_state_spec.rb +42 -0
  160. data/spec/state_machine/OO_structured_fsm/module_state_spec.rb +54 -0
  161. data/spec/state_machine/OO_structured_fsm/oo_structured_state_spec.rb +0 -0
  162. data/spec/state_machine/OO_structured_fsm/repetition_state_spec.rb +83 -0
  163. data/spec/state_machine/OO_structured_fsm/variable_state_spec.rb +40 -0
  164. data/spec/util/html_logger_spec.rb +31 -0
  165. data/spec/util/logger_spec.rb +20 -0
  166. data/spec/util/txt_logger_spec.rb +31 -0
  167. metadata +326 -0
@@ -0,0 +1,48 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::ConstructorState do
4
+
5
+ before :each do
6
+ @constructorTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+ it "Idle to constructor." do
11
+ @constructorTest.class_capture
12
+ @constructorTest.constructor_capture
13
+ expect(@constructorTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::ConstructorState)
15
+ end
16
+
17
+ it "Constructor to class." do
18
+ @constructorTest.class_capture
19
+ @constructorTest.constructor_capture
20
+ @constructorTest.class_capture
21
+ expect(@constructorTest.state)
22
+ .to be_instance_of(StateMachine::OOStructuredFSM::ClassState)
23
+ end
24
+
25
+ it "Constructor to idle." do
26
+ @constructorTest.class_capture
27
+ @constructorTest.constructor_capture
28
+ @constructorTest.class_capture
29
+ @constructorTest.idle_capture
30
+ expect(@constructorTest.state)
31
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
32
+ end
33
+ end
34
+
35
+ context "Incorrect flow." do
36
+ it "Try to access IdleState, from ConstructorState." do
37
+ @constructorTest.class_capture
38
+ @constructorTest.constructor_capture
39
+ expect{@constructorTest.idle_capture}
40
+ .to raise_error(NotImplementedError)
41
+ end
42
+ end
43
+
44
+ after :each do
45
+ @constructorTest = nil
46
+ end
47
+
48
+ end
@@ -0,0 +1,41 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::FunctionState do
4
+
5
+ before :each do
6
+ @rubyTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+
11
+ it "Idle to function." do
12
+ @rubyTest.state.function_capture
13
+ expect(@rubyTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::FunctionState)
15
+ end
16
+
17
+ it "Module to function" do
18
+ @rubyTest.state.module_capture
19
+ @rubyTest.state.function_capture
20
+ expect(@rubyTest.state)
21
+ .to be_instance_of(StateMachine::OOStructuredFSM::FunctionState)
22
+ end
23
+ end
24
+
25
+ context "Incorrect flow." do
26
+ it "Function to variable" do
27
+ @rubyTest.state.function_capture
28
+ expect{@rubyTest.variable_capture}
29
+ .to raise_error(NotImplementedError)
30
+ end
31
+ end
32
+
33
+ context "Flow based of file." do
34
+
35
+ end
36
+
37
+ after :each do
38
+ @rubyTest = nil
39
+ end
40
+
41
+ end
@@ -0,0 +1,101 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::IdleState do
4
+
5
+ before :each do
6
+ @rubyTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+
11
+ it "Idle to include." do
12
+ @rubyTest.include_capture
13
+ expect(@rubyTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::IncludeState)
15
+ end
16
+
17
+ it "Include to idle." do
18
+ @rubyTest.include_capture
19
+ @rubyTest.idle_capture
20
+ expect(@rubyTest.state)
21
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
22
+ end
23
+
24
+ it "Idle to variable." do
25
+ @rubyTest.variable_capture
26
+ expect(@rubyTest.state)
27
+ .to be_instance_of(StateMachine::OOStructuredFSM::VariableState)
28
+ end
29
+
30
+ it "Variable to idle." do
31
+ @rubyTest.variable_capture
32
+ @rubyTest.idle_capture
33
+ expect(@rubyTest.state)
34
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
35
+ end
36
+
37
+ it "Idle to function." do
38
+ @rubyTest.function_capture
39
+ expect(@rubyTest.state)
40
+ .to be_instance_of(StateMachine::OOStructuredFSM::FunctionState)
41
+ end
42
+
43
+ it "Function to idle." do
44
+ @rubyTest.function_capture
45
+ @rubyTest.idle_capture
46
+ expect(@rubyTest.state)
47
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
48
+ end
49
+
50
+ it "Idle to module." do
51
+ @rubyTest.module_capture
52
+ expect(@rubyTest.state)
53
+ .to be_instance_of(StateMachine::OOStructuredFSM::ModuleState)
54
+ end
55
+
56
+ it "Module to idle." do
57
+ @rubyTest.module_capture
58
+ @rubyTest.idle_capture
59
+ expect(@rubyTest.state)
60
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
61
+ end
62
+
63
+ it "Idle to class." do
64
+ @rubyTest.class_capture
65
+ expect(@rubyTest.state)
66
+ .to be_instance_of(StateMachine::OOStructuredFSM::ClassState)
67
+ end
68
+
69
+ it "Class to idle." do
70
+ @rubyTest.class_capture
71
+ @rubyTest.idle_capture
72
+ expect(@rubyTest.state)
73
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
74
+ end
75
+
76
+ end
77
+
78
+ context "Incorrect Flow" do
79
+
80
+ it "Idle to Method." do
81
+ expect{@rubyTest.method_capture}
82
+ .to raise_error(NotImplementedError)
83
+ end
84
+
85
+ it "Idle to Attribute" do
86
+ expect{@rubyTest.attribute_capture}
87
+ .to raise_error(NotImplementedError)
88
+ end
89
+
90
+ it "Idle to constructor" do
91
+ expect{@rubyTest.constructor_capture}
92
+ .to raise_error(NotImplementedError)
93
+ end
94
+
95
+ end
96
+
97
+ after :each do
98
+ @rubyTest = nil
99
+ end
100
+
101
+ end
@@ -0,0 +1,62 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::IncludeState do
4
+
5
+ before :each do
6
+ @rubyTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+
11
+ it "Idle to Include" do
12
+ @rubyTest.state.include_capture
13
+ expect(@rubyTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::IncludeState)
15
+ end
16
+
17
+ it "Include to idle" do
18
+ @rubyTest.state.include_capture
19
+ @rubyTest.idle_capture
20
+ expect(@rubyTest.state)
21
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
22
+ end
23
+
24
+ end
25
+
26
+ context "Incorrect flow." do
27
+
28
+ it "Include to variable" do
29
+ @rubyTest.state.include_capture
30
+ expect{@rubyTest.variable_capture}
31
+ .to raise_error(NotImplementedError)
32
+ end
33
+
34
+ end
35
+
36
+ context "Correct flow, and correct data extration." do
37
+
38
+ it "Include state, and capture require." do
39
+ @rubyTest.state.include_capture
40
+ fileElement = Languages::FileElement.new("test_spec")
41
+ @rubyTest.state.execute(fileElement, "require_relative 'test_file.rb'")
42
+ expect(@rubyTest.state)
43
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
44
+ end
45
+
46
+ it "Include state, and returned value" do
47
+ @rubyTest.state.include_capture
48
+ fileElement = Languages::FileElement.new("test_spec")
49
+ fileElement = @rubyTest.state.execute(fileElement,
50
+ "require_relative 'test.rb'")
51
+ expect(fileElement.extern_requirements[0].name).to eq ("test")
52
+ expect(@rubyTest.state)
53
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
54
+ end
55
+
56
+ end
57
+
58
+ after :each do
59
+ @rubyTest = nil
60
+ end
61
+
62
+ end
@@ -0,0 +1,42 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::MethodState do
4
+
5
+ before :each do
6
+ @rubyTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+
11
+ it "Idle to method" do
12
+ @rubyTest.class_capture
13
+ @rubyTest.method_capture
14
+ expect(@rubyTest.state)
15
+ .to be_instance_of(StateMachine::OOStructuredFSM::MethodState)
16
+ end
17
+
18
+ it "Method to class" do
19
+ @rubyTest.class_capture
20
+ @rubyTest.method_capture
21
+ @rubyTest.class_capture
22
+ expect(@rubyTest.state)
23
+ .to be_instance_of(StateMachine::OOStructuredFSM::ClassState)
24
+ end
25
+
26
+ end
27
+
28
+ context "Incorrect flow." do
29
+
30
+ it "Method to idle" do
31
+ @rubyTest.class_capture
32
+ @rubyTest.method_capture
33
+ expect{@rubyTest.idle_capture}
34
+ end
35
+
36
+ end
37
+
38
+ after :each do
39
+ @rubyTest = nil
40
+ end
41
+
42
+ end
@@ -0,0 +1,54 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::ModuleState do
4
+
5
+ before :each do
6
+ @rubyTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+
11
+ it "Idle to module" do
12
+ @rubyTest.state.module_capture
13
+ expect(@rubyTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::ModuleState)
15
+ end
16
+
17
+ it "Module to idle" do
18
+ @rubyTest.state.module_capture
19
+ @rubyTest.state.idle_capture
20
+ expect(@rubyTest.state)
21
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
22
+ end
23
+
24
+ it "Module to function" do
25
+ @rubyTest.state.module_capture
26
+ @rubyTest.state.function_capture
27
+ expect(@rubyTest.state)
28
+ .to be_instance_of(StateMachine::OOStructuredFSM::FunctionState)
29
+ end
30
+
31
+ it "Module to class" do
32
+ @rubyTest.state.module_capture
33
+ @rubyTest.state.class_capture
34
+ expect(@rubyTest.state)
35
+ .to be_instance_of(StateMachine::OOStructuredFSM::ClassState)
36
+ end
37
+
38
+ end
39
+
40
+ context "Incorrect flow." do
41
+
42
+ it "Incorrect flow" do
43
+ @rubyTest.state.module_capture
44
+ expect{@rubyTest.method_capture}
45
+ .to raise_error(NotImplementedError)
46
+ end
47
+
48
+ end
49
+
50
+ after :each do
51
+ @rubyTest = nil
52
+ end
53
+
54
+ end
@@ -0,0 +1,83 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::RepetitionState do
4
+
5
+ before :each do
6
+ @repetitionTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow, function." do
10
+ it "Idle to global function, to repetition." do
11
+ @repetitionTest.state.function_capture
12
+ @repetitionTest.state.repetition_capture
13
+ expect(@repetitionTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::RepetitionState)
15
+ end
16
+
17
+ it "Repetition to idle." do
18
+ @repetitionTest.state.function_capture
19
+ @repetitionTest.state.repetition_capture
20
+ @repetitionTest.state.function_capture
21
+ expect(@repetitionTest.state)
22
+ .to be_instance_of(StateMachine::OOStructuredFSM::FunctionState)
23
+ end
24
+ end
25
+
26
+ context "Correct flow, method." do
27
+ it "Idle to class, method, and repetition." do
28
+ @repetitionTest.state.class_capture
29
+ @repetitionTest.state.method_capture
30
+ @repetitionTest.state.repetition_capture
31
+ expect(@repetitionTest.state)
32
+ .to be_instance_of(StateMachine::OOStructuredFSM::RepetitionState)
33
+ end
34
+
35
+ it "Conditional to idle (method)." do
36
+ @repetitionTest.state.class_capture
37
+ @repetitionTest.state.method_capture
38
+ @repetitionTest.state.repetition_capture
39
+ @repetitionTest.state.method_capture
40
+ expect(@repetitionTest.state)
41
+ .to be_instance_of(StateMachine::OOStructuredFSM::MethodState)
42
+ end
43
+ end
44
+
45
+ context "Correct flow, constructor." do
46
+ it "Idle to constructor, and repetition." do
47
+ @repetitionTest.state.class_capture
48
+ @repetitionTest.state.constructor_capture
49
+ @repetitionTest.state.repetition_capture
50
+ expect(@repetitionTest.state)
51
+ .to be_instance_of(StateMachine::OOStructuredFSM::RepetitionState)
52
+ end
53
+
54
+ it "Repetition to idle (constructor)." do
55
+ @repetitionTest.state.class_capture
56
+ @repetitionTest.state.constructor_capture
57
+ @repetitionTest.state.repetition_capture
58
+ @repetitionTest.state.constructor_capture
59
+ expect(@repetitionTest.state)
60
+ .to be_instance_of(StateMachine::OOStructuredFSM::ConstructorState)
61
+ end
62
+ end
63
+
64
+ context "Incorrect flow." do
65
+ it "Try to access IdleState, to ConditionalState." do
66
+ expect{@repetitionTest.state.repetition_capture}
67
+ .to raise_error(NotImplementedError)
68
+ end
69
+
70
+ it "Try to jump from Conditional state to idle." do
71
+ @repetitionTest.state.class_capture
72
+ @repetitionTest.state.method_capture
73
+ @repetitionTest.state.repetition_capture
74
+ expect{@repetitionTest.state.class_capture}
75
+ .to raise_error(NotImplementedError)
76
+ end
77
+ end
78
+
79
+ after :each do
80
+ @constructorTest = nil
81
+ end
82
+
83
+ end
@@ -0,0 +1,40 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe StateMachine::OOStructuredFSM::VariableState do
4
+
5
+ before :each do
6
+ @rubyTest = Languages::RubySyntax.new
7
+ end
8
+
9
+ context "Correct flow." do
10
+
11
+ it "Idle to variable." do
12
+ @rubyTest.variable_capture
13
+ expect(@rubyTest.state)
14
+ .to be_instance_of(StateMachine::OOStructuredFSM::VariableState)
15
+ end
16
+
17
+ it "Variable to idle." do
18
+ @rubyTest.variable_capture
19
+ @rubyTest.idle_capture
20
+ expect(@rubyTest.state)
21
+ .to be_instance_of(StateMachine::OOStructuredFSM::IdleState)
22
+ end
23
+
24
+ end
25
+
26
+ context "Incorrect flow." do
27
+
28
+ it "Variable to module." do
29
+ @rubyTest.variable_capture
30
+ expect{@rubyTest.module_capture}
31
+ .to raise_error(NotImplementedError)
32
+ end
33
+
34
+ end
35
+
36
+ after :all do
37
+ @rubyTest = nil
38
+ end
39
+
40
+ end
@@ -0,0 +1,31 @@
1
+ require_relative '../spec_helper'
2
+
3
+ RSpec.describe Util::HtmlLogger do
4
+ context "Write html log" do
5
+
6
+ before :all do
7
+ @html = Util::HtmlLogger.new("log.html")
8
+ @html.write_log("HTML log")
9
+ end
10
+
11
+ it "Create file" do
12
+ expect(File.exists?("log.html")).to eq (true)
13
+ end
14
+
15
+ it "Write message" do
16
+ message = Array.new
17
+ File.open("log.html").each_line do |line|
18
+ if line.include?("<i>")
19
+ message = line
20
+ end
21
+ end
22
+ expect(message).to eq ("\t<i>HTML log</i>\n")
23
+ end
24
+
25
+ after :all do
26
+ File.delete("log.html")
27
+ @html = nil
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ require_relative '../spec_helper'
2
+
3
+ RSpec.describe Util::Logger do
4
+
5
+ before :all do
6
+ @abstractLogger = Util::Logger.new
7
+ end
8
+
9
+ context "Try to write." do
10
+ it "Try to access implemented error." do
11
+ expect{@abstractLogger.write_log("xpto")}.to raise_error(
12
+ NotImplementedError)
13
+ end
14
+ end
15
+
16
+ after :all do
17
+ @abstractLogger = nil
18
+ end
19
+
20
+ end
@@ -0,0 +1,31 @@
1
+ require_relative '../spec_helper'
2
+
3
+ RSpec.describe Util::TxtLogger do
4
+ context "Write txt log" do
5
+
6
+ before :all do
7
+ @txt = Util::TxtLogger.new("kuniri_log.txt")
8
+ @txt.write_log("Text file log")
9
+ end
10
+
11
+ it "Create file" do
12
+ expect(File.exists?("kuniri_log.txt")).to eq (true)
13
+ end
14
+
15
+ it "Write message" do
16
+ message = Array.new
17
+ File.open("kuniri_log.txt").each_line do |line|
18
+ if line.include?("message:")
19
+ message = line.split(':')
20
+ end
21
+ end
22
+ expect(message[1]).to eq (" Text file log\n")
23
+ end
24
+
25
+ after :all do
26
+ File.delete("kuniri_log.txt")
27
+ @txt = nil
28
+ end
29
+
30
+ end
31
+ end