spec/worksheet_spec.rb in rubyfromexcel-0.0.4 vs spec/worksheet_spec.rb in rubyfromexcel-0.0.5
- old
+ new
@@ -7,22 +7,22 @@
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" mc:Ignorable="mv" mc:PreserveAttributes="mv:*"><dimension ref="A1:A2"/><sheetViews><sheetView view="pageLayout" workbookViewId="0"/></sheetViews><sheetFormatPr baseColWidth="10" defaultRowHeight="13"/><sheetData><row r="1" spans="1:1"><c r="A1" t="str"><f>IF(A2="Hello","hello",Sheet2!B4)</f><v>hello</v></c></row><row r="2" spans="1:1"><c r="A2" t="s"><v>24</v></c></row></sheetData><sheetCalcPr fullCalcOnLoad="1"/><phoneticPr fontId="2" type="noConversion"/><pageMargins left="0.75" right="0.75" top="1" bottom="1" header="0.5" footer="0.5"/><pageSetup paperSize="10" orientation="portrait" horizontalDpi="4294967292" verticalDpi="4294967292"/><extLst><ext xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" uri="http://schemas.microsoft.com/office/mac/excel/2008/main"><mx:PLV Mode="1" OnePage="0" WScale="0"/></ext></extLst></worksheet>
END
simple_worksheet_ruby =<<END
# coding: utf-8
-#
+# Outputs
class Sheet1 < Spreadsheet
def a1; @a1 ||= excel_if(a2=="Hello","hello",sheet2.b4); end
def a2; "A shared string"; end
end
END
simple_worksheet_test =<<END
# coding: utf-8
require_relative '../spreadsheet'
-#
+# Outputs
describe 'Sheet1' do
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
it 'cell a1 should equal "hello"' do
sheet1.a1.should == "hello"
@@ -42,11 +42,11 @@
worksheet.to_test.should == simple_worksheet_test
end
named_reference_simple_worksheet_ruby =<<END
# coding: utf-8
-#
+# Outputs
class Sheet1 < Spreadsheet
def a1; @a1 ||= excel_if(a2=="Hello","hello",sheet2.b4); end
def a2; "A shared string"; end
def reference_one; sheet2.a1; end
end
@@ -67,11 +67,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" mc:Ignorable="mv" mc:PreserveAttributes="mv:*"><dimension ref="A1:A10"/><sheetViews><sheetView tabSelected="1" view="pageLayout" workbookViewId="0"><selection activeCell="B5" sqref="B5"/></sheetView></sheetViews><sheetFormatPr baseColWidth="10" defaultRowHeight="13"/><sheetData><row r="1" spans="1:1"><c r="A1"><v>1</v></c></row><row r="2" spans="1:1"><c r="A2"><f>A1*2</f><v>2</v></c></row><row r="3" spans="1:1"><c r="A3"><f t="shared" ref="A3:A9" si="0">A2*2</f><v>4</v></c></row><row r="4" spans="1:1"><c r="A4"><f t="shared" si="0"/><v>8</v></c></row><row r="5" spans="1:1"><c r="A5"><f t="shared" si="0"/><v>16</v></c></row><row r="6" spans="1:1"><c r="A6"><f t="shared" si="0"/><v>32</v></c></row><row r="7" spans="1:1"><c r="A7"><f t="shared" si="0"/><v>64</v></c></row><row r="8" spans="1:1"><c r="A8"><f t="shared" si="0"/><v>128</v></c></row><row r="9" spans="1:1"><c r="A9"><f t="shared" si="0"/><v>256</v></c></row><row r="10" spans="1:1"><c r="A10"><f>A9*2</f><v>512</v></c></row></sheetData><phoneticPr fontId="1" type="noConversion"/><pageMargins left="0.75" right="0.75" top="1" bottom="1" header="0.5" footer="0.5"/><pageSetup paperSize="10" orientation="portrait" horizontalDpi="4294967292" verticalDpi="4294967292"/><extLst><ext xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" uri="http://schemas.microsoft.com/office/mac/excel/2008/main"><mx:PLV Mode="1" OnePage="0" WScale="0"/></ext></extLst></worksheet>
END
shared_formula_worksheet_ruby =<<END
# coding: utf-8
-#
+# Outputs
class Sheet1 < Spreadsheet
def a1; 1.0; end
def a2; @a2 ||= a1*2.0; end
def a3; @a3 ||= a2*2.0; end
def a4; @a4 ||= a3*2.0; end
@@ -86,48 +86,48 @@
END
shared_formula_worksheet_test =<<END
# coding: utf-8
require_relative '../spreadsheet'
-#
+# Outputs
describe 'Sheet1' do
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
it 'cell a2 should equal 2.0' do
- sheet1.a2.should be_close(2.0,0.2)
+ sheet1.a2.should be_within(0.2).of(2.0)
end
it 'cell a3 should equal 4.0' do
- sheet1.a3.should be_close(4.0,0.4)
+ sheet1.a3.should be_within(0.4).of(4.0)
end
it 'cell a4 should equal 8.0' do
- sheet1.a4.should be_close(8.0,0.8)
+ sheet1.a4.should be_within(0.8).of(8.0)
end
it 'cell a5 should equal 16.0' do
- sheet1.a5.should be_close(16.0,1.6)
+ sheet1.a5.should be_within(1.6).of(16.0)
end
it 'cell a6 should equal 32.0' do
- sheet1.a6.should be_close(32.0,3.2)
+ sheet1.a6.should be_within(3.2).of(32.0)
end
it 'cell a7 should equal 64.0' do
- sheet1.a7.should be_close(64.0,6.4)
+ sheet1.a7.should be_within(6.4).of(64.0)
end
it 'cell a8 should equal 128.0' do
- sheet1.a8.should be_close(128.0,12.8)
+ sheet1.a8.should be_within(12.8).of(128.0)
end
it 'cell a9 should equal 256.0' do
- sheet1.a9.should be_close(256.0,25.6)
+ sheet1.a9.should be_within(25.6).of(256.0)
end
it 'cell a10 should equal 512.0' do
- sheet1.a10.should be_close(512.0,51.2)
+ sheet1.a10.should be_within(51.2).of(512.0)
end
end
END
@@ -145,11 +145,11 @@
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" mc:Ignorable="mv" mc:PreserveAttributes="mv:*"><dimension ref="A1:B5"/><sheetViews><sheetView tabSelected="1" view="pageLayout" workbookViewId="0"><selection activeCell="B6" sqref="B6"/></sheetView></sheetViews><sheetFormatPr baseColWidth="10" defaultRowHeight="13"/><sheetData><row r="1" spans="1:2"><c r="A1"><v>1</v></c><c r="B1"><f t="array" ref="B1:B5">A1:A5</f><v>1</v></c></row><row r="2" spans="1:2"><c r="A2"><v>2</v></c><c r="B2"><v>2</v></c></row><row r="3" spans="1:2"><c r="A3"><v>3</v></c><c r="B3"><v>3</v></c></row><row r="4" spans="1:2"><c r="A4"><v>4</v></c><c r="B4"><v>4</v></c></row><row r="5" spans="1:2"><c r="A5"><v>5</v></c><c r="B5"><v>5</v></c></row></sheetData><phoneticPr fontId="1" type="noConversion"/><pageMargins left="0.75" right="0.75" top="1" bottom="1" header="0.5" footer="0.5"/><pageSetup paperSize="10" orientation="portrait" horizontalDpi="4294967292" verticalDpi="4294967292"/><extLst><ext xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" uri="http://schemas.microsoft.com/office/mac/excel/2008/main"><mx:PLV Mode="1" OnePage="0" WScale="0"/></ext></extLst></worksheet>
END
array_formula_worksheet_ruby =<<END
# coding: utf-8
-#
+# Outputs
class Sheet1 < Spreadsheet
def a1; 1.0; end
def b1_array; @b1_array ||= a('a1','a5'); end
def b1; @b1 ||= b1_array.array_formula_offset(0,0); end
def a2; 2.0; end
@@ -165,32 +165,32 @@
END
array_formula_worksheet_test =<<END
# coding: utf-8
require_relative '../spreadsheet'
-#
+# Outputs
describe 'Sheet1' do
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
it 'cell b1 should equal 1.0' do
- sheet1.b1.should be_close(1.0,0.1)
+ sheet1.b1.should be_within(0.1).of(1.0)
end
it 'cell b2 should equal 2.0' do
- sheet1.b2.should be_close(2.0,0.2)
+ sheet1.b2.should be_within(0.2).of(2.0)
end
it 'cell b3 should equal 3.0' do
- sheet1.b3.should be_close(3.0,0.3)
+ sheet1.b3.should be_within(0.30000000000000004).of(3.0)
end
it 'cell b4 should equal 4.0' do
- sheet1.b4.should be_close(4.0,0.4)
+ sheet1.b4.should be_within(0.4).of(4.0)
end
it 'cell b5 should equal 5.0' do
- sheet1.b5.should be_close(5.0,0.5)
+ sheet1.b5.should be_within(0.5).of(5.0)
end
end
END
@@ -342,11 +342,11 @@
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="4" uniqueCount="4"><si><t>ColA</t></si><si><t>ColB</t></si><si><t>ColC</t></si><si><t>Total</t></si></sst>
END
table_worksheet_ruby =<<END
# coding: utf-8
-#
+# Outputs
class Sheet1 < Spreadsheet
def b3; "ColA"; end
def c3; "ColB"; end
def d3; "ColC"; end
def f3; @f3 ||= sheet1.c3; end
@@ -374,75 +374,75 @@
END
table_worksheet_test =<<END
# coding: utf-8
require_relative '../spreadsheet'
-#
+# Outputs
describe 'Sheet1' do
def sheet1; $spreadsheet ||= Spreadsheet.new; $spreadsheet.sheet1; end
it 'cell f3 should equal "ColB"' do
sheet1.f3.should == "ColB"
end
it 'cell h3 should equal 3.0' do
- sheet1.h3.should be_close(3.0,0.3)
+ sheet1.h3.should be_within(0.30000000000000004).of(3.0)
end
it 'cell c4 should equal 4.0' do
- sheet1.c4.should be_close(4.0,0.4)
+ sheet1.c4.should be_within(0.4).of(4.0)
end
it 'cell d4 should equal 3.0' do
- sheet1.d4.should be_close(3.0,0.3)
+ sheet1.d4.should be_within(0.30000000000000004).of(3.0)
end
it 'cell f4 should equal 8.0' do
- sheet1.f4.should be_close(8.0,0.8)
+ sheet1.f4.should be_within(0.8).of(8.0)
end
it 'cell h4 should equal 3.0' do
- sheet1.h4.should be_close(3.0,0.3)
+ sheet1.h4.should be_within(0.30000000000000004).of(3.0)
end
it 'cell c5 should equal 8.0' do
- sheet1.c5.should be_close(8.0,0.8)
+ sheet1.c5.should be_within(0.8).of(8.0)
end
it 'cell d5 should equal 6.0' do
- sheet1.d5.should be_close(6.0,0.6)
+ sheet1.d5.should be_within(0.6000000000000001).of(6.0)
end
it 'cell f5 should equal 8.0' do
- sheet1.f5.should be_close(8.0,0.8)
+ sheet1.f5.should be_within(0.8).of(8.0)
end
it 'cell c6 should equal 12.0' do
- sheet1.c6.should be_close(12.0,1.2)
+ sheet1.c6.should be_within(1.2000000000000002).of(12.0)
end
it 'cell d6 should equal 9.0' do
- sheet1.d6.should be_close(9.0,0.9)
+ sheet1.d6.should be_within(0.9).of(9.0)
end
it 'cell c7 should equal 8.0' do
- sheet1.c7.should be_close(8.0,0.8)
+ sheet1.c7.should be_within(0.8).of(8.0)
end
it 'cell d7 should equal 3.0' do
- sheet1.d7.should be_close(3.0,0.3)
+ sheet1.d7.should be_within(0.30000000000000004).of(3.0)
end
it 'cell b10 should equal 6.0' do
- sheet1.b10.should be_close(6.0,0.6)
+ sheet1.b10.should be_within(0.6000000000000001).of(6.0)
end
it 'cell c10 should equal 8.0' do
- sheet1.c10.should be_close(8.0,0.8)
+ sheet1.c10.should be_within(0.8).of(8.0)
end
it 'cell d10 should equal 3.0' do
- sheet1.d10.should be_close(3.0,0.3)
+ sheet1.d10.should be_within(0.30000000000000004).of(3.0)
end
end
END
\ No newline at end of file