rubyfromexcel 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +22 -0
- data/bin/rubyfromexcel +20 -0
- data/examples/create_and_test_examples.rb +37 -0
- data/examples/ruby-versions/array-formulas-ruby/sheets/sheet1.rb +59 -0
- data/examples/ruby-versions/array-formulas-ruby/sheets/sheet2.rb +9 -0
- data/examples/ruby-versions/array-formulas-ruby/specs/sheet1_rspec.rb +156 -0
- data/examples/ruby-versions/array-formulas-ruby/specs/sheet2_rspec.rb +8 -0
- data/examples/ruby-versions/array-formulas-ruby/spreadsheet.rb +9 -0
- data/examples/ruby-versions/complex-test-ruby/sheets/sheet1.rb +305 -0
- data/examples/ruby-versions/complex-test-ruby/sheets/sheet2.rb +147 -0
- data/examples/ruby-versions/complex-test-ruby/specs/sheet1_rspec.rb +876 -0
- data/examples/ruby-versions/complex-test-ruby/specs/sheet2_rspec.rb +412 -0
- data/examples/ruby-versions/complex-test-ruby/spreadsheet.rb +9 -0
- data/examples/ruby-versions/namedReferenceTest-ruby/sheets/sheet1.rb +9 -0
- data/examples/ruby-versions/namedReferenceTest-ruby/sheets/sheet2.rb +8 -0
- data/examples/ruby-versions/namedReferenceTest-ruby/specs/sheet1_rspec.rb +16 -0
- data/examples/ruby-versions/namedReferenceTest-ruby/specs/sheet2_rspec.rb +16 -0
- data/examples/ruby-versions/namedReferenceTest-ruby/spreadsheet.rb +9 -0
- data/examples/ruby-versions/pruning-ruby/sheets/sheet1.rb +11 -0
- data/examples/ruby-versions/pruning-ruby/sheets/sheet2.rb +14 -0
- data/examples/ruby-versions/pruning-ruby/sheets/sheet3.rb +7 -0
- data/examples/ruby-versions/pruning-ruby/specs/sheet1_rspec.rb +20 -0
- data/examples/ruby-versions/pruning-ruby/specs/sheet2_rspec.rb +20 -0
- data/examples/ruby-versions/pruning-ruby/specs/sheet3_rspec.rb +8 -0
- data/examples/ruby-versions/pruning-ruby/spreadsheet.rb +9 -0
- data/examples/ruby-versions/sharedFormulaTest-ruby/sheets/sheet1.rb +15 -0
- data/examples/ruby-versions/sharedFormulaTest-ruby/specs/sheet1_rspec.rb +44 -0
- data/examples/ruby-versions/sharedFormulaTest-ruby/spreadsheet.rb +9 -0
- data/examples/ruby-versions/table-test-ruby/sheets/sheet1.rb +17 -0
- data/examples/ruby-versions/table-test-ruby/sheets/sheet2.rb +5 -0
- data/examples/ruby-versions/table-test-ruby/sheets/sheet3.rb +5 -0
- data/examples/ruby-versions/table-test-ruby/specs/sheet1_rspec.rb +20 -0
- data/examples/ruby-versions/table-test-ruby/specs/sheet2_rspec.rb +8 -0
- data/examples/ruby-versions/table-test-ruby/specs/sheet3_rspec.rb +8 -0
- data/examples/ruby-versions/table-test-ruby/spreadsheet.rb +9 -0
- data/examples/sheets/array-formulas.xlsx +0 -0
- data/examples/sheets/complex-test.xlsx +0 -0
- data/examples/sheets/namedReferenceTest.xlsx +0 -0
- data/examples/sheets/pruning.xlsx +0 -0
- data/examples/sheets/sharedFormulaTest.xlsx +0 -0
- data/examples/sheets/table-test.xlsx +0 -0
- data/examples/sheets/~$array-formulas.xlsx +0 -0
- data/examples/unzipped-sheets/array-formulas/[Content_Types].xml +2 -0
- data/examples/unzipped-sheets/array-formulas/docProps/app.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/docProps/core.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/docProps/thumbnail.jpeg +0 -0
- data/examples/unzipped-sheets/array-formulas/xl/_rels/workbook.xml.rels +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/calcChain.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/sharedStrings.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/styles.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/theme/theme1.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/workbook.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/worksheets/sheet1.xml +2 -0
- data/examples/unzipped-sheets/array-formulas/xl/worksheets/sheet2.xml +2 -0
- data/examples/unzipped-sheets/complex-test/[Content_Types].xml +2 -0
- data/examples/unzipped-sheets/complex-test/docProps/app.xml +2 -0
- data/examples/unzipped-sheets/complex-test/docProps/core.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/_rels/workbook.xml.rels +2 -0
- data/examples/unzipped-sheets/complex-test/xl/calcChain.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/charts/chart1.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/charts/chart2.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/comments1.xml +5 -0
- data/examples/unzipped-sheets/complex-test/xl/comments2.xml +5 -0
- data/examples/unzipped-sheets/complex-test/xl/drawings/_rels/drawing1.xml.rels +2 -0
- data/examples/unzipped-sheets/complex-test/xl/drawings/_rels/drawing2.xml.rels +2 -0
- data/examples/unzipped-sheets/complex-test/xl/drawings/drawing1.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/drawings/drawing2.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/drawings/vmlDrawing1.vml +46 -0
- data/examples/unzipped-sheets/complex-test/xl/drawings/vmlDrawing2.vml +46 -0
- data/examples/unzipped-sheets/complex-test/xl/sharedStrings.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/styles.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/theme/theme1.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/workbook.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/worksheets/_rels/sheet1.xml.rels +2 -0
- data/examples/unzipped-sheets/complex-test/xl/worksheets/_rels/sheet2.xml.rels +2 -0
- data/examples/unzipped-sheets/complex-test/xl/worksheets/sheet1.xml +2 -0
- data/examples/unzipped-sheets/complex-test/xl/worksheets/sheet2.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/[Content_Types].xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/docProps/app.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/docProps/core.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/docProps/thumbnail.jpeg +0 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/_rels/workbook.xml.rels +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/calcChain.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/styles.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/theme/theme1.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/workbook.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/worksheets/sheet1.xml +2 -0
- data/examples/unzipped-sheets/namedReferenceTest/xl/worksheets/sheet2.xml +2 -0
- data/examples/unzipped-sheets/pruning/[Content_Types].xml +2 -0
- data/examples/unzipped-sheets/pruning/docProps/app.xml +2 -0
- data/examples/unzipped-sheets/pruning/docProps/core.xml +2 -0
- data/examples/unzipped-sheets/pruning/docProps/thumbnail.jpeg +0 -0
- data/examples/unzipped-sheets/pruning/xl/_rels/workbook.xml.rels +2 -0
- data/examples/unzipped-sheets/pruning/xl/calcChain.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/sharedStrings.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/styles.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/theme/theme1.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/workbook.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/worksheets/sheet1.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/worksheets/sheet2.xml +2 -0
- data/examples/unzipped-sheets/pruning/xl/worksheets/sheet3.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/[Content_Types].xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/docProps/app.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/docProps/core.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/docProps/thumbnail.jpeg +0 -0
- data/examples/unzipped-sheets/sharedFormulaTest/xl/_rels/workbook.xml.rels +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/xl/calcChain.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/xl/styles.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/xl/theme/theme1.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/xl/workbook.xml +2 -0
- data/examples/unzipped-sheets/sharedFormulaTest/xl/worksheets/sheet1.xml +2 -0
- data/examples/unzipped-sheets/table-test/[Content_Types].xml +2 -0
- data/examples/unzipped-sheets/table-test/docProps/app.xml +2 -0
- data/examples/unzipped-sheets/table-test/docProps/core.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/_rels/workbook.xml.rels +2 -0
- data/examples/unzipped-sheets/table-test/xl/calcChain.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/printerSettings/printerSettings1.bin +0 -0
- data/examples/unzipped-sheets/table-test/xl/sharedStrings.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/styles.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/tables/table1.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/theme/theme1.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/workbook.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/worksheets/_rels/sheet1.xml.rels +2 -0
- data/examples/unzipped-sheets/table-test/xl/worksheets/sheet1.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/worksheets/sheet2.xml +2 -0
- data/examples/unzipped-sheets/table-test/xl/worksheets/sheet3.xml +2 -0
- data/lib/cells/array/array_formula_builder.rb +58 -0
- data/lib/cells/array/array_formula_cell.rb +27 -0
- data/lib/cells/array/arraying_formula_cell.rb +67 -0
- data/lib/cells/array/single_cell_array_formula_builder.rb +9 -0
- data/lib/cells/array/single_cell_array_formula_cell.rb +11 -0
- data/lib/cells/cell.rb +98 -0
- data/lib/cells/cells.rb +9 -0
- data/lib/cells/formula/formula_cell.rb +18 -0
- data/lib/cells/formula/simple_formula_cell.rb +4 -0
- data/lib/cells/shared/shared_formula_builder.rb +15 -0
- data/lib/cells/shared/shared_formula_cell.rb +20 -0
- data/lib/cells/shared/sharing_formula_cell.rb +36 -0
- data/lib/cells/value/value_cell.rb +24 -0
- data/lib/excelfile/excelfile.rb +6 -0
- data/lib/excelfile/relationships.rb +24 -0
- data/lib/excelfile/shared_strings.rb +21 -0
- data/lib/excelfile/sheet_names.rb +6 -0
- data/lib/excelfile/table.rb +116 -0
- data/lib/excelfile/workbook.rb +108 -0
- data/lib/excelfile/worksheet.rb +122 -0
- data/lib/formulae/compile/formula_builder.rb +316 -0
- data/lib/formulae/formulae.rb +6 -0
- data/lib/formulae/parse/formula_peg.rb +213 -0
- data/lib/formulae/parse/formula_peg.txt +40 -0
- data/lib/formulae/run/excel_functions.rb +375 -0
- data/lib/formulae/run/excel_matrix.rb +114 -0
- data/lib/formulae/run/excel_range.rb +256 -0
- data/lib/formulae/run/reference.rb +79 -0
- data/lib/optimiser/dependency_builder.rb +86 -0
- data/lib/optimiser/optimiser.rb +3 -0
- data/lib/optimiser/shared_formula_dependency_builder.rb +43 -0
- data/lib/optimiser/workbook_pruner.rb +80 -0
- data/lib/rubyfromexcel.rb +105 -0
- data/lib/runtime/runtime_formula_builder.rb +32 -0
- data/spec/array_formula_builder_spec.rb +35 -0
- data/spec/array_formula_cell_spec.rb +17 -0
- data/spec/arraying_formula_cell_spec.rb +38 -0
- data/spec/dependency_builder_spec.rb +71 -0
- data/spec/excel_functions_spec.rb +381 -0
- data/spec/excel_matrix_spec.rb +92 -0
- data/spec/excel_range_spec.rb +161 -0
- data/spec/formula_builder_spec.rb +230 -0
- data/spec/formula_peg_spec.rb +165 -0
- data/spec/reference_spec.rb +72 -0
- data/spec/relationships_spec.rb +51 -0
- data/spec/runtime_formula_builder_spec.rb +55 -0
- data/spec/shared_formula_builder_spec.rb +29 -0
- data/spec/shared_formula_cell_spec.rb +23 -0
- data/spec/shared_formula_dependency_builder_spec.rb +48 -0
- data/spec/shared_strings_spec.rb +14 -0
- data/spec/sharing_formula_cell_spec.rb +79 -0
- data/spec/simple_formula_cell_spec.rb +78 -0
- data/spec/single_cell_array_formula_builder_spec.rb +19 -0
- data/spec/single_cell_array_formula_cell_spec.rb +25 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/table_spec.rb +100 -0
- data/spec/value_cell_spec.rb +49 -0
- data/spec/workbook_pruner_spec.rb +27 -0
- data/spec/workbook_spec.rb +283 -0
- data/spec/worksheet_failiures_spec.rb +41 -0
- data/spec/worksheet_spec.rb +486 -0
- metadata +291 -0
@@ -0,0 +1,412 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../spreadsheet'
|
3
|
+
# OLD UK
|
4
|
+
describe 'Sheet2' do
|
5
|
+
def sheet2; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet2; end
|
6
|
+
|
7
|
+
it 'cell d5 should equal 160.40945' do
|
8
|
+
sheet2.d5.should be_close(160.40945,16.040945)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'cell e5 should equal 157.61832557' do
|
12
|
+
sheet2.e5.should be_close(157.61832557,15.761832557)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'cell f5 should equal 154.875766705082' do
|
16
|
+
sheet2.f5.should be_close(154.875766705082,15.4875766705082)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'cell g5 should equal 152.180928364414' do
|
20
|
+
sheet2.g5.should be_close(152.180928364414,15.2180928364414)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'cell h5 should equal 149.532980210873' do
|
24
|
+
sheet2.h5.should be_close(149.532980210873,14.9532980210873)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'cell i5 should equal 146.931106355204' do
|
28
|
+
sheet2.i5.should be_close(146.931106355204,14.6931106355204)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'cell j5 should equal 144.374505104623' do
|
32
|
+
sheet2.j5.should be_close(144.374505104623,14.4374505104623)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'cell c6 should equal 134.166975' do
|
36
|
+
sheet2.c6.should be_close(134.166975,13.4166975)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'cell d6 should equal 131.832469635' do
|
40
|
+
sheet2.d6.should be_close(131.832469635,13.1832469635)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'cell e6 should equal 129.538584663351' do
|
44
|
+
sheet2.e6.should be_close(129.538584663351,12.9538584663351)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'cell f6 should equal 127.284613290209' do
|
48
|
+
sheet2.f6.should be_close(127.284613290209,12.7284613290209)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'cell g6 should equal 125.069861018959' do
|
52
|
+
sheet2.g6.should be_close(125.069861018959,12.5069861018959)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'cell h6 should equal 122.893645437229' do
|
56
|
+
sheet2.h6.should be_close(122.893645437229,12.2893645437229)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'cell i6 should equal 120.755296006621' do
|
60
|
+
sheet2.i6.should be_close(120.755296006621,12.0755296006621)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'cell j6 should equal 118.654153856106' do
|
64
|
+
sheet2.j6.should be_close(118.654153856106,11.8654153856106)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'cell l6 should equal 0.0174000000000001' do
|
68
|
+
sheet2.l6.should be_close(0.0174000000000001,0.00174000000000001)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'cell c7 should equal 297.416975' do
|
72
|
+
sheet2.c7.should be_close(297.416975,29.7416975)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'cell d7 should equal 292.241919635' do
|
76
|
+
sheet2.d7.should be_close(292.241919635,29.2241919635)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'cell e7 should equal 287.156910233351' do
|
80
|
+
sheet2.e7.should be_close(287.156910233351,28.7156910233351)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'cell f7 should equal 282.160379995291' do
|
84
|
+
sheet2.f7.should be_close(282.160379995291,28.2160379995291)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'cell g7 should equal 277.250789383373' do
|
88
|
+
sheet2.g7.should be_close(277.250789383373,27.7250789383373)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'cell h7 should equal 272.426625648102' do
|
92
|
+
sheet2.h7.should be_close(272.426625648102,27.2426625648102)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'cell i7 should equal 267.686402361825' do
|
96
|
+
sheet2.i7.should be_close(267.686402361825,26.7686402361825)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'cell j7 should equal 263.028658960729' do
|
100
|
+
sheet2.j7.should be_close(263.028658960729,26.3028658960729)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'cell c9 should equal 2013.0' do
|
104
|
+
sheet2.c9.should be_close(2013.0,201.3)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'cell d9 should equal 2014.0' do
|
108
|
+
sheet2.d9.should be_close(2014.0,201.4)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'cell e9 should equal 2015.0' do
|
112
|
+
sheet2.e9.should be_close(2015.0,201.5)
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'cell f9 should equal 2016.0' do
|
116
|
+
sheet2.f9.should be_close(2016.0,201.6)
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'cell g9 should equal 2017.0' do
|
120
|
+
sheet2.g9.should be_close(2017.0,201.7)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'cell h9 should equal 2018.0' do
|
124
|
+
sheet2.h9.should be_close(2018.0,201.8)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'cell i9 should equal 2019.0' do
|
128
|
+
sheet2.i9.should be_close(2019.0,201.9)
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'cell j9 should equal 2020.0' do
|
132
|
+
sheet2.j9.should be_close(2020.0,202.0)
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'cell d10 should equal 1.0' do
|
136
|
+
sheet2.d10.should be_close(1.0,0.1)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'cell e10 should equal 1.0' do
|
140
|
+
sheet2.e10.should be_close(1.0,0.1)
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'cell f10 should equal 1.0' do
|
144
|
+
sheet2.f10.should be_close(1.0,0.1)
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'cell g10 should equal 1.0' do
|
148
|
+
sheet2.g10.should be_close(1.0,0.1)
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'cell h10 should equal 1.0' do
|
152
|
+
sheet2.h10.should be_close(1.0,0.1)
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'cell i10 should equal 1.0' do
|
156
|
+
sheet2.i10.should be_close(1.0,0.1)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'cell j10 should equal 1.0' do
|
160
|
+
sheet2.j10.should be_close(1.0,0.1)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'cell d11 should equal 0.314285714285714' do
|
164
|
+
sheet2.d11.should be_close(0.314285714285714,0.0314285714285714)
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'cell e11 should equal 0.428571428571429' do
|
168
|
+
sheet2.e11.should be_close(0.428571428571429,0.0428571428571429)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'cell f11 should equal 0.542857142857143' do
|
172
|
+
sheet2.f11.should be_close(0.542857142857143,0.0542857142857143)
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'cell g11 should equal 0.657142857142857' do
|
176
|
+
sheet2.g11.should be_close(0.657142857142857,0.0657142857142857)
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'cell h11 should equal 0.771428571428572' do
|
180
|
+
sheet2.h11.should be_close(0.771428571428572,0.0771428571428572)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'cell i11 should equal 0.885714285714286' do
|
184
|
+
sheet2.i11.should be_close(0.885714285714286,0.0885714285714286)
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'cell l11 should equal 0.114285714285714' do
|
188
|
+
sheet2.l11.should be_close(0.114285714285714,0.0114285714285714)
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'cell c12 should equal 0.639114142694781' do
|
192
|
+
sheet2.c12.should be_close(0.639114142694781,0.0639114142694781)
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'cell d12 should equal 0.690669265166955' do
|
196
|
+
sheet2.d12.should be_close(0.690669265166955,0.0690669265166955)
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'cell e12 should equal 0.742224387639129' do
|
200
|
+
sheet2.e12.should be_close(0.742224387639129,0.0742224387639129)
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'cell f12 should equal 0.793779510111303' do
|
204
|
+
sheet2.f12.should be_close(0.793779510111303,0.0793779510111303)
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'cell g12 should equal 0.845334632583478' do
|
208
|
+
sheet2.g12.should be_close(0.845334632583478,0.0845334632583478)
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'cell h12 should equal 0.896889755055652' do
|
212
|
+
sheet2.h12.should be_close(0.896889755055652,0.0896889755055652)
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'cell i12 should equal 0.948444877527826' do
|
216
|
+
sheet2.i12.should be_close(0.948444877527826,0.0948444877527826)
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'cell j12 should equal 1.0' do
|
220
|
+
sheet2.j12.should be_close(1.0,0.1)
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'cell c14 should equal 2013.0' do
|
224
|
+
sheet2.c14.should be_close(2013.0,201.3)
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'cell d14 should equal 2014.0' do
|
228
|
+
sheet2.d14.should be_close(2014.0,201.4)
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'cell e14 should equal 2015.0' do
|
232
|
+
sheet2.e14.should be_close(2015.0,201.5)
|
233
|
+
end
|
234
|
+
|
235
|
+
it 'cell f14 should equal 2016.0' do
|
236
|
+
sheet2.f14.should be_close(2016.0,201.6)
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'cell g14 should equal 2017.0' do
|
240
|
+
sheet2.g14.should be_close(2017.0,201.7)
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'cell h14 should equal 2018.0' do
|
244
|
+
sheet2.h14.should be_close(2018.0,201.8)
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'cell i14 should equal 2019.0' do
|
248
|
+
sheet2.i14.should be_close(2019.0,201.9)
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'cell j14 should equal 2020.0' do
|
252
|
+
sheet2.j14.should be_close(2020.0,202.0)
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'cell d15 should equal 20.0' do
|
256
|
+
sheet2.d15.should be_close(20.0,2.0)
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'cell e15 should equal 20.0' do
|
260
|
+
sheet2.e15.should be_close(20.0,2.0)
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'cell f15 should equal 20.0' do
|
264
|
+
sheet2.f15.should be_close(20.0,2.0)
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'cell g15 should equal 20.0' do
|
268
|
+
sheet2.g15.should be_close(20.0,2.0)
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'cell h15 should equal 20.0' do
|
272
|
+
sheet2.h15.should be_close(20.0,2.0)
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'cell i15 should equal 20.0' do
|
276
|
+
sheet2.i15.should be_close(20.0,2.0)
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'cell j15 should equal 20.0' do
|
280
|
+
sheet2.j15.should be_close(20.0,2.0)
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'cell c17 should equal 2013.0' do
|
284
|
+
sheet2.c17.should be_close(2013.0,201.3)
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'cell d17 should equal 2014.0' do
|
288
|
+
sheet2.d17.should be_close(2014.0,201.4)
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'cell e17 should equal 2015.0' do
|
292
|
+
sheet2.e17.should be_close(2015.0,201.5)
|
293
|
+
end
|
294
|
+
|
295
|
+
it 'cell f17 should equal 2016.0' do
|
296
|
+
sheet2.f17.should be_close(2016.0,201.6)
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'cell g17 should equal 2017.0' do
|
300
|
+
sheet2.g17.should be_close(2017.0,201.7)
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'cell h17 should equal 2018.0' do
|
304
|
+
sheet2.h17.should be_close(2018.0,201.8)
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'cell i17 should equal 2019.0' do
|
308
|
+
sheet2.i17.should be_close(2019.0,201.9)
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'cell j17 should equal 2020.0' do
|
312
|
+
sheet2.j17.should be_close(2020.0,202.0)
|
313
|
+
end
|
314
|
+
|
315
|
+
it 'cell c18 should equal 3.265' do
|
316
|
+
sheet2.c18.should be_close(3.265,0.3265)
|
317
|
+
end
|
318
|
+
|
319
|
+
it 'cell d18 should equal 3.208189' do
|
320
|
+
sheet2.d18.should be_close(3.208189,0.3208189)
|
321
|
+
end
|
322
|
+
|
323
|
+
it 'cell e18 should equal 3.1523665114' do
|
324
|
+
sheet2.e18.should be_close(3.1523665114,0.31523665114)
|
325
|
+
end
|
326
|
+
|
327
|
+
it 'cell f18 should equal 3.09751533410164' do
|
328
|
+
sheet2.f18.should be_close(3.09751533410164,0.309751533410164)
|
329
|
+
end
|
330
|
+
|
331
|
+
it 'cell g18 should equal 3.04361856728827' do
|
332
|
+
sheet2.g18.should be_close(3.04361856728827,0.304361856728827)
|
333
|
+
end
|
334
|
+
|
335
|
+
it 'cell h18 should equal 2.99065960421746' do
|
336
|
+
sheet2.h18.should be_close(2.99065960421746,0.299065960421746)
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'cell i18 should equal 2.93862212710407' do
|
340
|
+
sheet2.i18.should be_close(2.93862212710407,0.293862212710407)
|
341
|
+
end
|
342
|
+
|
343
|
+
it 'cell j18 should equal 2.88749010209246' do
|
344
|
+
sheet2.j18.should be_close(2.88749010209246,0.288749010209246)
|
345
|
+
end
|
346
|
+
|
347
|
+
it 'cell c19 should equal 0.5366679' do
|
348
|
+
sheet2.c19.should be_close(0.5366679,0.05366679)
|
349
|
+
end
|
350
|
+
|
351
|
+
it 'cell d19 should equal 0.828661237705715' do
|
352
|
+
sheet2.d19.should be_close(0.828661237705715,0.0828661237705715)
|
353
|
+
end
|
354
|
+
|
355
|
+
it 'cell e19 should equal 1.11033072568587' do
|
356
|
+
sheet2.e19.should be_close(1.11033072568587,0.111033072568587)
|
357
|
+
end
|
358
|
+
|
359
|
+
it 'cell f19 should equal 1.38194723000798' do
|
360
|
+
sheet2.f19.should be_close(1.38194723000798,0.138194723000798)
|
361
|
+
end
|
362
|
+
|
363
|
+
it 'cell g19 should equal 1.64377531624918' do
|
364
|
+
sheet2.g19.should be_close(1.64377531624918,0.164377531624918)
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'cell h19 should equal 1.89607338674582' do
|
368
|
+
sheet2.h19.should be_close(1.89607338674582,0.189607338674582)
|
369
|
+
end
|
370
|
+
|
371
|
+
it 'cell i19 should equal 2.13909381497444' do
|
372
|
+
sheet2.i19.should be_close(2.13909381497444,0.213909381497444)
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'cell j19 should equal 2.37308307712212' do
|
376
|
+
sheet2.j19.should be_close(2.37308307712212,0.237308307712212)
|
377
|
+
end
|
378
|
+
|
379
|
+
it 'cell c20 should equal 3.8016679' do
|
380
|
+
sheet2.c20.should be_close(3.8016679,0.38016679)
|
381
|
+
end
|
382
|
+
|
383
|
+
it 'cell d20 should equal 4.03685023770571' do
|
384
|
+
sheet2.d20.should be_close(4.03685023770571,0.403685023770571)
|
385
|
+
end
|
386
|
+
|
387
|
+
it 'cell e20 should equal 4.26269723708587' do
|
388
|
+
sheet2.e20.should be_close(4.26269723708587,0.426269723708587)
|
389
|
+
end
|
390
|
+
|
391
|
+
it 'cell f20 should equal 4.47946256410962' do
|
392
|
+
sheet2.f20.should be_close(4.47946256410962,0.447946256410962)
|
393
|
+
end
|
394
|
+
|
395
|
+
it 'cell g20 should equal 4.68739388353745' do
|
396
|
+
sheet2.g20.should be_close(4.68739388353745,0.468739388353745)
|
397
|
+
end
|
398
|
+
|
399
|
+
it 'cell h20 should equal 4.88673299096328' do
|
400
|
+
sheet2.h20.should be_close(4.88673299096328,0.488673299096328)
|
401
|
+
end
|
402
|
+
|
403
|
+
it 'cell i20 should equal 5.07771594207851' do
|
404
|
+
sheet2.i20.should be_close(5.07771594207851,0.507771594207851)
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'cell j20 should equal 5.26057317921459' do
|
408
|
+
sheet2.j20.should be_close(5.26057317921459,0.526057317921459)
|
409
|
+
end
|
410
|
+
|
411
|
+
end
|
412
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../spreadsheet'
|
3
|
+
# Sheet1
|
4
|
+
describe 'Sheet1' do
|
5
|
+
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
|
6
|
+
|
7
|
+
it 'cell a4 should equal 1.0' do
|
8
|
+
sheet1.a4.should be_close(1.0,0.1)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'cell a5 should equal 2.0' do
|
12
|
+
sheet1.a5.should be_close(2.0,0.2)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../spreadsheet'
|
3
|
+
# Sheet1 (2)
|
4
|
+
describe 'Sheet2' do
|
5
|
+
def sheet2; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet2; end
|
6
|
+
|
7
|
+
it 'cell a2 should equal 5.0' do
|
8
|
+
sheet2.a2.should be_close(5.0,0.5)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'cell a3 should equal 3.0' do
|
12
|
+
sheet2.a3.should be_close(3.0,0.3)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Calcs
|
3
|
+
class Sheet2 < Spreadsheet
|
4
|
+
def a1; @a1 ||= sum(a('a2','a7')); end
|
5
|
+
def a2; 1.0; end
|
6
|
+
def a3; 2.0; end
|
7
|
+
def a4; @a4 ||= sheet3.a1; end
|
8
|
+
def a5; 4.0; end
|
9
|
+
def a6; 10.0; end
|
10
|
+
def a7; 5.0; end
|
11
|
+
def c8; "Inputs"; end
|
12
|
+
def c9; @c9 ||= sheet3.a3; end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../spreadsheet'
|
3
|
+
# Outputs
|
4
|
+
describe 'Sheet1' do
|
5
|
+
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
|
6
|
+
|
7
|
+
it 'cell b1 should equal 121.0' do
|
8
|
+
sheet1.b1.should be_close(121.0,12.1)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'cell b2 should equal 99.0' do
|
12
|
+
sheet1.b2.should be_close(99.0,9.9)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'cell b3 should equal "In result"' do
|
16
|
+
sheet1.b3.should == "In result"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../spreadsheet'
|
3
|
+
# Calcs
|
4
|
+
describe 'Sheet2' do
|
5
|
+
def sheet2; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet2; end
|
6
|
+
|
7
|
+
it 'cell a1 should equal 121.0' do
|
8
|
+
sheet2.a1.should be_close(121.0,12.1)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'cell a4 should equal 99.0' do
|
12
|
+
sheet2.a4.should be_close(99.0,9.9)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'cell c9 should equal "In result"' do
|
16
|
+
sheet2.c9.should == "In result"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Sheet1
|
3
|
+
class Sheet1 < Spreadsheet
|
4
|
+
def a1; 1.0; end
|
5
|
+
def a2; @a2 ||= a1*2.0; end
|
6
|
+
def a3; @a3 ||= a2*2.0; end
|
7
|
+
def a4; @a4 ||= a3*2.0; end
|
8
|
+
def a5; @a5 ||= a4*2.0; end
|
9
|
+
def a6; @a6 ||= a5*2.0; end
|
10
|
+
def a7; @a7 ||= a6*2.0; end
|
11
|
+
def a8; @a8 ||= a7*2.0; end
|
12
|
+
def a9; @a9 ||= a8*2.0; end
|
13
|
+
def a10; @a10 ||= a9*2.0; end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative '../spreadsheet'
|
3
|
+
# Sheet1
|
4
|
+
describe 'Sheet1' do
|
5
|
+
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
|
6
|
+
|
7
|
+
it 'cell a2 should equal 2.0' do
|
8
|
+
sheet1.a2.should be_close(2.0,0.2)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'cell a3 should equal 4.0' do
|
12
|
+
sheet1.a3.should be_close(4.0,0.4)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'cell a4 should equal 8.0' do
|
16
|
+
sheet1.a4.should be_close(8.0,0.8)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'cell a5 should equal 16.0' do
|
20
|
+
sheet1.a5.should be_close(16.0,1.6)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'cell a6 should equal 32.0' do
|
24
|
+
sheet1.a6.should be_close(32.0,3.2)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'cell a7 should equal 64.0' do
|
28
|
+
sheet1.a7.should be_close(64.0,6.4)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'cell a8 should equal 128.0' do
|
32
|
+
sheet1.a8.should be_close(128.0,12.8)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'cell a9 should equal 256.0' do
|
36
|
+
sheet1.a9.should be_close(256.0,25.6)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'cell a10 should equal 512.0' do
|
40
|
+
sheet1.a10.should be_close(512.0,51.2)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# Sheet1
|
3
|
+
class Sheet1 < Spreadsheet
|
4
|
+
def b2; "Column A"; end
|
5
|
+
def c2; "Column B "; end
|
6
|
+
def d2; "Column C"; end
|
7
|
+
def b3; 1.0; end
|
8
|
+
def c3; 2.0; end
|
9
|
+
def d3; @d3 ||= sheet1.b3+sheet1.c3; end
|
10
|
+
def b4; 3.0; end
|
11
|
+
def c4; 4.0; end
|
12
|
+
def d4; @d4 ||= sheet1.b4+sheet1.c4; end
|
13
|
+
def b5; 5.0; end
|
14
|
+
def c5; 6.0; end
|
15
|
+
def d5; @d5 ||= sheet1.b5+sheet1.c5; end
|
16
|
+
end
|
17
|
+
|