source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/cell_spec.rb
Ruby
mit
228
master
659
require_relative '../../spec_helper.rb' describe "ExcelFunctions: CELL" do it "should return the filename of the original excel file when passed 'filename' as its first argument" do FunctionTest.cell('filename', nil).should == "filename not specified" end it "should return an error when given inappropria...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/char_spec.rb
Ruby
mit
228
master
893
require_relative '../../spec_helper.rb' describe "ExcelFunctions: CHAR" do it "should return the character for a given windows character number (annoyingly, probably different on a mac)" do FunctionTest.char(0).should == :value FunctionTest.char(256).should == :value FunctionTest.char(1).should == "\x...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/cosh_spec.rb
Ruby
mit
228
master
388
require_relative '../../spec_helper.rb' describe "ExcelFunctions: COSH()" do it "should calculate COSH(number)" do FunctionTest.cosh(1).should == Math.cosh(1) end it "should treat nil as zero" do FunctionTest.cosh(nil).should == Math.cosh(0) end it "should return error if argument is an er...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/floor_spec.rb
Ruby
mit
228
master
840
require_relative '../../spec_helper.rb' describe "ExcelFunctions: FLOOR" do it "should return something when given appropriate arguments" do FunctionTest.floor(1990,100).should == 1900 FunctionTest.floor(10.99,0.1).should == 10.9 end it "should return an error when given inappropriate arguments" do ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/add_spec.rb
Ruby
mit
228
master
1,240
require_relative '../../spec_helper.rb' describe "ExcelFunctions: add(number,number)" do it "should return sum of its arguments" do FunctionTest.add(1,1).should == 2 FunctionTest.add(1.0,1.0).should == 2.0 end it "should treat nil as zero" do FunctionTest.add(1,nil).should == 1 FunctionTe...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/excel_if_spec.rb
Ruby
mit
228
master
1,143
require_relative '../../spec_helper.rb' describe "ExcelFunctions: IF() excel_if()" do it "should return its second argument if the first argument is true" do FunctionTest.excel_if(true,1,0).should == 1 end it "should return its third argument if the first argument is false" do FunctionTest.excel_if(f...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/min_spec.rb
Ruby
mit
228
master
762
require_relative '../../spec_helper.rb' describe "ExcelFunctions: MIN" do it "should return the argument with the smallest value, flattening arrays" do FunctionTest.min(1000,[10,100]).should == 10 end it "should ignore non numeric values" do FunctionTest.min("Asdasddf","aasdfa",1).should == 1 end...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/left_spec.rb
Ruby
mit
228
master
1,260
require_relative '../../spec_helper.rb' describe "ExcelFunctions: LEFT(string,[characters])" do it "should return the left n characters from a string" do FunctionTest.left("ONE").should == "O" FunctionTest.left("ONE",1).should == "O" FunctionTest.left("ONE",3).should == "ONE" end it "should turn ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/na_spec.rb
Ruby
mit
228
master
299
require_relative '../../spec_helper.rb' describe "ExcelFunctions: NA" do it "should return the NA error" do FunctionTest.na().should == :na end it "should be in the list of functions that can be mapped to ruby" do MapFormulaeToRuby::FUNCTIONS[:'NA'].should == 'na' end end
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/subtract_spec.rb
Ruby
mit
228
master
1,183
require_relative '../../spec_helper.rb' describe "ExcelFunctions: subtract(number,number)" do it "should return sum of its arguments" do FunctionTest.subtract(2,1).should == 1 FunctionTest.subtract(2.0,1.0).should == 1 end it "should treat nil as zero" do FunctionTest.subtract(1,nil).should =...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/ln_spec.rb
Ruby
mit
228
master
799
require_relative '../../spec_helper.rb' describe "ExcelFunctions: LN" do it "should return something when given appropriate arguments" do FunctionTest.ln(10).should == 2.302585092994046 FunctionTest.ln(8).should == 2.0794415416798357 FunctionTest.ln(0).should == :num FunctionTest.ln(-1).should == ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/less_than_or_equal_spec.rb
Ruby
mit
228
master
2,204
require_relative '../../spec_helper.rb' describe "ExcelFunctions: = less_than_or_equal?()" do it "should check the equality of numbers" do FunctionTest.less_than_or_equal?(1,2).should == true FunctionTest.less_than_or_equal?(1,1).should == true FunctionTest.less_than_or_equal?(1,0).should == false ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/log_spec.rb
Ruby
mit
228
master
780
require_relative '../../spec_helper.rb' describe "ExcelFunctions: LOG" do it "should return something when given appropriate arguments" do FunctionTest.log(10).should == 1 FunctionTest.log(10,10).should == 1 FunctionTest.log(8,2).should == 3 FunctionTest.log(0,2).should == :num end it "should...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/interpolate_spec.rb
Ruby
mit
228
master
1,702
require_relative '../../spec_helper.rb' describe "ExcelFunctions: INTERPOLATE" do it "Should take a range with a size of four and an integer index and return the value indexed" do FunctionTest.interpolate([[9,2,8,3]],1).should == 9 FunctionTest.interpolate([[9,2,8,3]],2).should == 2 FunctionTest.inter...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/hyperlink_spec.rb
Ruby
mit
228
master
732
require_relative '../../spec_helper.rb' describe "ExcelFunctions: HYPERLINK" do it "should treat its arguments as strings, always" do FunctionTest.hyperlink("A").should == "<a href=\"A\">A</a>" FunctionTest.hyperlink(1).should == "<a href=\"1\">1</a>" FunctionTest.hyperlink(true).should == "<a href=\"...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/ceiling_spec.rb
Ruby
mit
228
master
885
require_relative '../../spec_helper.rb' describe "ExcelFunctions: CEILING" do # Number\tSignificance\tMode\tCEILING.MATH(number, significance, mode) tests = <<-END 0.1 0.1 0 0.1 -0.1 0.1 0 -0.1 -0.1 0.1 1 -0.1 136 10 0 140 -136 10 0 -130 -136 10 1 -140 END tests = tests.split("\n").map { |l| l.split(...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/forecast_spec.rb
Ruby
mit
228
master
1,468
require_relative '../../spec_helper.rb' describe "ExcelFunctions: FORECAST" do it "should return a value based on the linear fit of the passed values" do known_x = [[1,2,3,4,5]] known_y = [[2,3,4,5,6]] FunctionTest.forecast(0,known_y, known_x).should == 1 FunctionTest.forecast(1,known_y, known_x)....
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/lookup_spec.rb
Ruby
mit
228
master
1,848
require_relative '../../spec_helper.rb' describe "ExcelFunctions: LOOKUP" do it "should return the value in the result vector that matches the index of lookup_value in lookup_vector" do lookup_vector = [ [ 4.14 ], [ 4.19 ], [ 5.17 ], [ 5.77 ], [ 6.39 ], ] result_vector = ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/project_spec.rb
Ruby
mit
228
master
684
require_relative '../../spec_helper.rb' describe "ExcelFunctions: PROJECT" do it "should return something when given appropriate arguments" do FunctionTest.project(1).should == 1 end it "should return an error when given inappropriate arguments" do FunctionTest.project("Asdasddf").should == :value ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/isnumber_spec.rb
Ruby
mit
228
master
587
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ISNUMBER" do it "should return true if a number, false otherwise" do FunctionTest.isnumber(1).should == true FunctionTest.isnumber(true).should == false FunctionTest.isnumber("Hello").should == false FunctionTest.isnumber(nil).shoul...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/more_than_spec.rb
Ruby
mit
228
master
1,930
require_relative '../../spec_helper.rb' describe "ExcelFunctions: = more_than?()" do it "should check the equality of numbers" do FunctionTest.more_than?(1,2).should == false FunctionTest.more_than?(1,1).should == false FunctionTest.more_than?(1,0).should == true FunctionTest.more_than?(1.0,1).sho...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/rounddown_spec.rb
Ruby
mit
228
master
1,068
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ROUNDDOWN(number,decimal places)" do it "should round numbers down" do FunctionTest.rounddown(1.0,0).should == 1.0 FunctionTest.rounddown(1.1,0).should == 1.0 FunctionTest.rounddown(1.5,0).should == 1.0 FunctionTest.rounddown(1.53,1...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/roundup_spec.rb
Ruby
mit
228
master
1,048
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ROUNDUP(number,decimal places)" do it "should round numbers up correctly" do FunctionTest.roundup(1.0,0).should == 1.0 FunctionTest.roundup(1.1,0).should == 2.0 FunctionTest.roundup(1.5,0).should == 2.0 FunctionTest.roundup(1.53,1)....
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/more_than_or_equal_spec.rb
Ruby
mit
228
master
2,167
require_relative '../../spec_helper.rb' describe "ExcelFunctions: = more_than_or_equal?()" do it "should check the equality of numbers" do FunctionTest.more_than_or_equal?(1,2).should == false FunctionTest.more_than_or_equal?(1,1).should == true FunctionTest.more_than_or_equal?(1,0).should == true ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/value_spec.rb
Ruby
mit
228
master
883
require_relative '../../spec_helper.rb' describe "ExcelFunctions: VALUE" do it "should return a number when passed a number" do FunctionTest.value(1).should == 1 end it "should return a number when passed a string containing a number" do FunctionTest.value("1").should == 1 FunctionTest.value("1.0...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/round_spec.rb
Ruby
mit
228
master
1,074
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ROUND" do it "should round numbers correctly" do FunctionTest.round(1.1,0).should == 1.0 FunctionTest.round(1.5,0).should == 2.0 FunctionTest.round(1.56,1).should == 1.6 end it "should work if arguments are given as strings, so l...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/count_spec.rb
Ruby
mit
228
master
729
require_relative '../../spec_helper.rb' describe "ExcelFunctions: COUNT(arg1,[arg2],..)" do it "should count the number of numeric values in an area" do FunctionTest.count(1,"two",[[10],[100],[:error],[nil]]).should == 3 end it "should not count strings that contain numbers" do FunctionTest.count...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/lower_spec.rb
Ruby
mit
228
master
701
require_relative '../../spec_helper.rb' describe "ExcelFunctions: LOWER" do it "should return a lower case string of whatever is passed to it" do FunctionTest.lower("HELLO").should == "hello" FunctionTest.lower(1).should == "1" FunctionTest.lower(true).should == "true" FunctionTest.lower(false).sh...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/sumproduct_spec.rb
Ruby
mit
228
master
1,538
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SUMPRODUCT" do it "should multiply together and then sum the elements in row or column areas given as arguments" do FunctionTest.sumproduct([[10],[100],[nil]],[[nil],[100],[10]]).should == 100*100 end it "should return :value when miss-mat...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/mmult_spec.rb
Ruby
mit
228
master
1,008
require_relative '../../spec_helper.rb' describe "ExcelFunctions: MMULT" do it "should return something when given appropriate arguments" do FunctionTest.mmult([[1,2],[3,4]],[[4,3],[2,1]]).should == [[8,5],[20,13]] FunctionTest.mmult([[1,2]],[[3],[4]]).should == [[11]] end it "should return an error ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/vlookup_spec.rb
Ruby
mit
228
master
1,806
require_relative '../../spec_helper.rb' describe "ExcelFunctions: VLOOKUP" do it "should match the first argument against the first column of the table in the second argument, returning the value in the column specified by the third argument" do FunctionTest.vlookup(2.0,[[1,'a'],[2,'b'],[3,'c']],2).should == ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/index_spec.rb
Ruby
mit
228
master
2,346
require_relative '../../spec_helper.rb' describe "ExcelFunctions: INDEX(array,row_number,[column_number])" do it "should return the value in the array at position row_number, column_number" do FunctionTest.index(10,1,1).should == 10 FunctionTest.index([[10],["pear"]],2.0).should == "pear" FunctionTest...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/multiply_spec.rb
Ruby
mit
228
master
1,192
require_relative '../../spec_helper.rb' describe "ExcelFunctions: multiply(number,number)" do it "should return the multiple of its arguments" do FunctionTest.multiply(3,4).should == 12 FunctionTest.multiply(0.5,1.5).should == 0.75 end it "should treat nil as zero" do FunctionTest.multiply(1,...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/negative_spec.rb
Ruby
mit
228
master
919
require_relative '../../spec_helper.rb' describe "negative(function) should be equivalent to -function" do it "should return the negative of its arguments" do FunctionTest.negative(1).should == -1 FunctionTest.negative(-1).should == 1 end it "should treat strings that only contain numbers as number...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/text_spec.rb
Ruby
mit
228
master
2,492
require_relative '../../spec_helper.rb' describe "ExcelFunctions: TEXT" do it "should turn a number into a percentage when the second argument is 0%" do FunctionTest.text(1, "0%").should == "100%" FunctionTest.text(0.196, "0%").should == "20%" FunctionTest.text("0.196", "0%").should == "20%" Func...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/sqrt_spec.rb
Ruby
mit
228
master
797
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SQRT" do it "should return something when given appropriate arguments" do FunctionTest.sqrt(1).should == 1 FunctionTest.sqrt(4).should == 2 FunctionTest.sqrt(1.6).should == 1.2649110640673518 end it "should return an error when giv...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/right_spec.rb
Ruby
mit
228
master
1,439
require_relative '../../spec_helper.rb' describe "ExcelFunctions: RIGHT(string,[characters])" do it "should return the right n characters from a string" do FunctionTest.right("ONE").should == "E" FunctionTest.right("ONE",1).should == "E" FunctionTest.right("ONE",3).should == "ONE" FunctionTest.rig...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/power_spec.rb
Ruby
mit
228
master
1,455
require_relative '../../spec_helper.rb' describe "ExcelFunctions: power(number,number)" do it "should return power of its arguments" do FunctionTest.power(2,0).should == 1 FunctionTest.power(2,3).should == 8 FunctionTest.power(4.0,0.5).should == 2.0 FunctionTest.power(0.5,0.5).should ==0.707106781...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/excel_match_spec.rb
Ruby
mit
228
master
1,624
require_relative '../../spec_helper.rb' describe "ExcelFunctions: excel_match(lookup_value,lookup_array,match_type)" do it "should return the first matching value in the lookup array, or :na if not found" do FunctionTest.excel_match(10.0,[[10,100]],0.0).should == 1 FunctionTest.excel_match(100.0,[[10,100]...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/scurve_spec.rb
Ruby
mit
228
master
1,494
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SCURVE" do it "scurve should return something when given appropriate arguments" do FunctionTest.scurve(2018,0,10,10).round.should == 0 FunctionTest.scurve(2023,0,10,10).round.should == 5 FunctionTest.scurve(2028,0,10,10).round.should ==...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/average_spec.rb
Ruby
mit
228
master
770
require_relative '../../spec_helper.rb' describe "ExcelFunctions: AVERAGE()" do it "should return the average of its arguments" do FunctionTest.average(1,2,3).should == 2 FunctionTest.average(1,2).should == 1.5 end it "should return the average of its arguments, flattening arrays" do FunctionTest...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/replace_spec.rb
Ruby
mit
228
master
838
require_relative '../../spec_helper.rb' describe "ExcelFunctions: REPLACE" do it "should replace some characters in a string" do FunctionTest.replace("1234",1,1,'@').should == "@234" FunctionTest.replace("1234",2,2,'@').should == "1@4" FunctionTest.replace("1234",10,2,'@').should == "1234@" end i...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/substitute_spec.rb
Ruby
mit
228
master
1,817
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SUBSTITUTE" do it "it should replace any occurences of its second argument in its first argument with its third argument. If its fourth argument is emptly, all arguments replaced, otherwise the ioccurence given by the number in its fourth argument ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/isblank_spec.rb
Ruby
mit
228
master
560
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ISBLANK" do it "should return true if passed an empty value and false in all other situations" do FunctionTest.isblank(nil).should == true FunctionTest.isblank(1).should == false FunctionTest.isblank(:error).should == false Function...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/not_spec.rb
Ruby
mit
228
master
1,091
require_relative '../../spec_helper.rb' describe "ExcelFunctions: NOT (implemented as excel_not)" do it "should return the NOT of the given argument " do FunctionTest.excel_not(true).should == false FunctionTest.excel_not(false).should == true end it "should treat 0 values as false and other number...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/countifs_spec.rb
Ruby
mit
228
master
1,455
require_relative '../../spec_helper.rb' describe "ExcelFunctions: COUNTIFS" do it "should only count values that meet all of the criteria" do FunctionTest.countifs([[10],[100],[nil]],10.0,[["pear"],["bear"],["apple"]],'Bear').should == 0.0 FunctionTest.countifs([[10],[100],[nil]],10.0,[["pear"],["bear"],[...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/find_spec.rb
Ruby
mit
228
master
2,632
require_relative '../../spec_helper.rb' describe "ExcelFunctions: FIND(text,within_text,[start_num])" do it "should find the first occurrence of one string in another, returning :value if the string doesn't match'" do FunctionTest.find("one","onetwothree").should == 1 FunctionTest.find("one","twoonethree"...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/divide_spec.rb
Ruby
mit
228
master
1,164
require_relative '../../spec_helper.rb' describe "ExcelFunctions: divide(number,number)" do it "should return sum of its arguments" do FunctionTest.divide(4,2).should == 2 FunctionTest.divide(1.0,0.5).should == 2.0 end it "should return a :div0! if a divide by zero occurs" do FunctionTest.divid...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/pv_spec.rb
Ruby
mit
228
master
1,090
require_relative '../../spec_helper.rb' describe "ExcelFunctions: PV(rate, nper, pmt, fv, type)" do it "should return the present value of an investment" do FunctionTest.pv(0.03,12.0,100).round.should == -995 FunctionTest.pv(0.03,12.0,-100.0,100.0).round.should == 925 FunctionTest.pv(0.03,12.0,-100,-1...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/choose_spec.rb
Ruby
mit
228
master
1,076
require_relative '../../spec_helper.rb' describe "ExcelFunctions: CHOOSE(index,arg1,arg2,arg3)" do it "should return index-th numbered argument, where index is the first argument" do FunctionTest.choose(1,10,20,30).should == 10 FunctionTest.choose(2,10,20,30).should == 20 FunctionTest.choose(1,[10,20,...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/excel_equal_spec.rb
Ruby
mit
228
master
1,526
require_relative '../../spec_helper.rb' describe "ExcelFunctions: = excel_equal?()" do it "should check the equality of numbers" do FunctionTest.excel_equal?(1,1).should == true FunctionTest.excel_equal?(1,0).should == false FunctionTest.excel_equal?(1.0,1).should == true end it "should check t...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/mod_spec.rb
Ruby
mit
228
master
1,307
require_relative '../../spec_helper.rb' describe "ExcelFunctions: MOD" do it "should return the remainder of a number" do FunctionTest.mod(10,3).should == 1.0 FunctionTest.mod(10,5).should == 0.0 FunctionTest.mod(1.1,1).should be_within(0.01).of(0.1) end it "should be possible for the the argum...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/string_argument_spec.rb
Ruby
mit
228
master
515
require_relative '../../spec_helper.rb' describe "ExcelFunctions: string_argument(thing)" do { "string" => "string", nil => "", 1 => "1", 1.23 => "1.23", true => "TRUE", false => "FALSE", :name => "#NAME?", :value => "#VALUE!", :div0 => "#DIV/0!", :ref => "#REF!", :na =...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/exp_spec.rb
Ruby
mit
228
master
912
require_relative '../../spec_helper.rb' describe "ExcelFunctions: EXP" do it "should return something when given appropriate arguments" do FunctionTest.exp(0).should == 1 FunctionTest.exp(1).should == 2.718281828459045 FunctionTest.exp("1").should == 2.718281828459045 FunctionTest.exp(-1).should =...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/and_spec.rb
Ruby
mit
228
master
1,281
require_relative '../../spec_helper.rb' describe "ExcelFunctions: AND (implemented as excel_and)" do it "should return the AND of the given arguments, which can be arrays" do FunctionTest.excel_and(true,true).should == true FunctionTest.excel_and(true,false).should == false FunctionTest.excel_and(fals...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/project_in_array_spec.rb
Ruby
mit
228
master
747
require_relative '../../spec_helper.rb' describe "ExcelFunctions: PROJECT_IN_ARRAY" do it "should return something when given appropriate arguments" do FunctionTest.project_in_array(1).should == 1 end it "should return an error when given inappropriate arguments" do FunctionTest.project_in_array("Asd...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/sumif_spec.rb
Ruby
mit
228
master
1,560
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SUMIF" do it "should only sum values in the area that meet the criteria" do FunctionTest.sumif(10,10.0).should == 10.0 FunctionTest.sumif(10,10.0,20).should == 20 FunctionTest.sumif([[10],[100],[nil]],10.0).should == 10.0 FunctionTe...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/product_spec.rb
Ruby
mit
228
master
892
require_relative '../../spec_helper.rb' describe "ExcelFunctions: PRODUCT" do it "should return the product of its arguments" do FunctionTest.product(1,2,3).should == 6 end it "should return the product of its arguments, flattening arrays" do FunctionTest.product([[1],[2],[3]]).should == 6 end ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/trim_spec.rb
Ruby
mit
228
master
632
require_relative '../../spec_helper.rb' describe "ExcelFunctions: TRIM" do it "should return text with all leading and trailing space removed and only single spaces within" do FunctionTest.trim(" This is a long space ").should == "This is a long space" FunctionTest.trim("Thisisok").should == "Thi...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/max_spec.rb
Ruby
mit
228
master
813
require_relative '../../spec_helper.rb' describe "ExcelFunctions: MAX" do it "should return the argument with the greatest value, flattening arrays" do FunctionTest.max(1,[10,100]).should == 100 end it "should ignore non numeric values" do FunctionTest.max("Asdasddf","aasdfa",1).should == 1 e...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/sum_spec.rb
Ruby
mit
228
master
828
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SUM()" do it "should return the sum of its arguments" do FunctionTest.sum(1,2,3).should == 6 end it "should return the sum of its arguments, flattening arrays" do FunctionTest.sum([[1],[2],[3]]).should == 6 end it "should ignore...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/or_spec.rb
Ruby
mit
228
master
1,431
require_relative '../../spec_helper.rb' describe "ExcelFunctions: OR" do it "should return the OR of the given arguments, which can be arrays" do FunctionTest.excel_or(true,true).should == true FunctionTest.excel_or(true,false).should == true FunctionTest.excel_or(false,true).should == true Functi...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/pmt_spec.rb
Ruby
mit
228
master
1,516
require_relative '../../spec_helper.rb' describe "ExcelFunctions: PMT(rate,number_of_periods,present_value) - optional arguments not yet implemented" do it "should calculate the monthly payment required for a given principal, interest rate and loan period" do FunctionTest.pmt(0.1,10,100).should be_within(0.01...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/mround_spec.rb
Ruby
mit
228
master
688
require_relative '../../spec_helper.rb' describe "ExcelFunctions: MROUND" do it "should return something when given appropriate arguments" do [ [nil, nil, 0], [1, nil, 0], [nil, 1, 0], ["a",1, :value], [1, "a", :value], [:error, 1, :error], [1, :error, :error], ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/len_spec.rb
Ruby
mit
228
master
637
require_relative '../../spec_helper.rb' describe "ExcelFunctions: LEN" do it "should return the length of a passed string, if not a string, convert to a string first" do FunctionTest.len(nil).should == 0 FunctionTest.len("Hello").should == 5 FunctionTest.len(123).should == 3 FunctionTest.len(true)...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/sumifs_spec.rb
Ruby
mit
228
master
2,048
require_relative '../../spec_helper.rb' describe "ExcelFunctions: SUMIFS" do it "should only sum values that meet all of the criteria" do FunctionTest.sumifs([[10],[100],[nil]],[[10],[100],[nil]],10.0,[["pear"],["bear"],["apple"]],'Bear').should == 0.0 FunctionTest.sumifs([[10],[100],[nil]],[[10],[100],[nil...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/mid_spec.rb
Ruby
mit
228
master
1,295
require_relative '../../spec_helper.rb' describe "ExcelFunctions: MID" do it "should return a substring of the first argument, starting at the character number of the second number and going on for the number of characters in the last argument" do FunctionTest.mid("ABCDEFGHIJK",1,1).should == "A" Function...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/int_spec.rb
Ruby
mit
228
master
897
require_relative '../../spec_helper.rb' describe "ExcelFunctions: INT" do it "should int numbers down to nearest integer correctly" do FunctionTest.int(8.9).should == 8.0 FunctionTest.int(-8.9).should == -9.0 end it "should work if arguments are given as strings, so long as the strings contain numb...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/fillgaps_in_array_spec.rb
Ruby
mit
228
master
762
require_relative '../../spec_helper.rb' describe "ExcelFunctions: FILLGAPS_IN_ARRAY" do it "Should fill in blank values in passed array" do FunctionTest.fillgaps_in_array(4,1,[[1,nil,nil,4]], [[2001, 2002, 2003, 2004]], 2004).should ==[[1,2,3,4]] end it "Should cope with being in just a single cell" do ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/exact_spec.rb
Ruby
mit
228
master
1,066
require_relative '../../spec_helper.rb' describe "ExcelFunctions: EXACT" do it "Should perform a case sensitive equality check on strings" do FunctionTest.exact("word", "word").should == true FunctionTest.exact("Word", "word").should == false FunctionTest.exact("w ord", "word").should == false end ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/countif_spec.rb
Ruby
mit
228
master
1,186
require_relative '../../spec_helper.rb' describe "ExcelFunctions: COUNTIF" do it "should only count values in the area that meet the criteria" do FunctionTest.countif(10,10.0).should == 1 FunctionTest.countif([[10],[100],[nil]],10.0).should == 1 FunctionTest.countif([[10,100,nil]],10.0).should == 1 ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/ensure_is_number_spec.rb
Ruby
mit
228
master
872
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ENSURE_IS_NUMBER" do it "should ensure the passed argument becomes a number where possible" do FunctionTest.ensure_is_number(1).should == 1 FunctionTest.ensure_is_number(nil).should == 0 FunctionTest.ensure_is_number(true).should == 1 ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/number_or_zero_spec.rb
Ruby
mit
228
master
769
require_relative '../../spec_helper.rb' describe "ExcelFunctions: NUMBER_OR_ZERO" do it "should return a number when given a number, an error if given an error, otherwise nothing" do FunctionTest.number_or_zero(0).should == 0 FunctionTest.number_or_zero(1).should == 1 FunctionTest.number_or_zero(:erro...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/less_than_spec.rb
Ruby
mit
228
master
1,927
require_relative '../../spec_helper.rb' describe "ExcelFunctions: = less_than?()" do it "should check the equality of numbers" do FunctionTest.less_than?(1,2).should == true FunctionTest.less_than?(1,1).should == false FunctionTest.less_than?(1,0).should == false FunctionTest.less_than?(1.0,1).sho...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/unicode_spec.rb
Ruby
mit
228
master
840
require_relative '../../spec_helper.rb' describe "ExcelFunctions: UNICODE" do it "should return the codepoint of the first character in a string" do FunctionTest.unicode("A").should == 65 FunctionTest.unicode("B").should == 66 FunctionTest.unicode("ㇴ").should == 12788 end it "should convert numbe...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/iserr_spec.rb
Ruby
mit
228
master
882
require_relative '../../spec_helper.rb' describe "ExcelFunctions: ISERR" do it "should return false if the passed error is #N/A (wtf?)" do FunctionTest.iserr(:na).should == false end it "should return true if passed any other sort of error" do FunctionTest.iserr(:div0).should == true FunctionTest...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/iferror_spec.rb
Ruby
mit
228
master
793
require_relative '../../spec_helper.rb' describe "ExcelFunctions: IFERROR(value,value_if_error)" do it "should return its second value if there is an error in the first" do FunctionTest.iferror("ok","Not found").should == "ok" FunctionTest.iferror(:value,"Not found").should == "Not found" end it "s...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/abs_spec.rb
Ruby
mit
228
master
724
require_relative '../../spec_helper.rb' describe "ExcelFunctions: abs(number,number)" do it "should return the absolute value of its argument" do FunctionTest.abs(1).should == 1 FunctionTest.abs(-1).should == 1 end it "should return a 1 if the argument is true, 0 if the argument is false" do Fu...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/excel/excel_functions/fillgaps_spec.rb
Ruby
mit
228
master
376
require_relative '../../spec_helper.rb' describe "ExcelFunctions: FILLGAPS" do it "should return something when given appropriate arguments" do FunctionTest.fillgaps([[1]], [[2001]], 2001).should ==[[1]] end it "should be in the list of functions that can be mapped to ruby" do MapFormulaeToRuby::F...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/compile/ruby/compile_to_ruby_unit_test_spec.rb
Ruby
mit
228
master
2,678
require_relative '../../spec_helper' describe CompileToRubyUnitTest do def compile(input, sloppy = false, sheet_names = {}) output = StringIO.new CompileToRubyUnitTest.rewrite(input, sloppy, sheet_names, {}, output) output.string end it "should compile basic values and give precise tests when sl...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/compile/ruby/map_formulae_to_ruby_spec.rb
Ruby
mit
228
master
970
require_relative '../../spec_helper' describe MapFormulaeToRuby do before(:all) do @mapper = MapFormulaeToRuby.new @mapper.sheet_names = {'test' => 'test', 'A complicated sheet name' => 'a_complicated_sheet_name'} end checks = test_data('formulae_to_ruby.txt').each_line.map.with_index { |line,i|...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/compile/ruby/compile_to_ruby_spec.rb
Ruby
mit
228
master
2,748
require_relative '../../spec_helper' describe CompileToRuby do def compile(input, sheet_names = {}, settable = nil) output = StringIO.new c = CompileToRuby.new c.settable = settable c.rewrite(input,sheet_names,output) output.string end it "should compile simple arithmetic" do input...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/compile/ruby/map_sheet_names_to_ruby_names_spec.rb
Ruby
mit
228
master
866
require_relative '../../spec_helper' describe MapSheetNamesToRubyNames do it "should take a file with worksheet names in its first column and create a file with worksheet names in the first column and a ruby equivalent in the second" do input = <<END sheet1 file1 A name with (unaceptable) characters file2 A clashin...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/compile/c/compile_named_reference_setters_spec.rb
Ruby
mit
228
master
2,015
require_relative '../../spec_helper' describe CompileNamedReferenceSetters do def compile(input, sheet_names, cells_that_can_be_set_at_runtime) output = StringIO.new c = CompileNamedReferenceSetters.new c.cells_that_can_be_set_at_runtime = cells_that_can_be_set_at_runtime c.rewrite(input, sheet_names, outpu...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_array_formulae_to_arrays_spec.rb
Ruby
mit
228
master
719
require_relative '../spec_helper' describe RewriteArrayFormulaeToArrays do it "should take array formula like 'reference\\array range\\tformula ast\\n' and convert the formula into array form" do input = StringIO.new(%Q|B6\tB6:B8\t[:arithmetic, [:array, [:row, [:cell, "A1"]], [:row, [:cell, "A2"]]], [:operato...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_named_reference_names_spec.rb
Ruby
mit
228
master
639
require_relative '../spec_helper' describe RewriteNamedReferenceNames do it "should take the results of extract_named_references.rb and create references that are suitable for use in the C code" do named_references = <<END \tIn_result\tInputs!$A$3 \tXI.v.Scenario\tInputs!$A$4 Inputs\tLocal_named_reference\tInputs!...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/ast_expand_array_formulae_spec.rb
Ruby
mit
228
master
719
require_relative '../spec_helper' describe AstExpandArrayFormulae do before(:all) do @mapper = AstExpandArrayFormulae.new @mapper.array_range = Area.for("B6:B8") @mapper.array_range.calculate_excel_variables end checks = test_data('ast_expand_array_formulae.txt').each_line.map.with_index { |...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/caching_formula_parser_spec.rb
Ruby
mit
228
master
3,532
require_relative '../spec_helper' describe CachingFormulaParser do it "should turn sheet and cell references into symbols" do CachingFormulaParser.parse("Sheet1!B$1").should == [:sheet_reference, :Sheet1, [:cell, :"B$1"]] CachingFormulaParser.parse("Sheet1!B$1:B10").should == [:sheet_reference, :Sheet1, [...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_formulae_to_ast_spec.rb
Ruby
mit
228
master
635
require_relative '../spec_helper' describe RewriteFormulaeToAst do it "should take input in the form: 'thing\\tthing\\tformula\\n' where the last field is always a forumla and map the formulae to ast to produce 'thing\\tthing\\tast\\n'" do input = StringIO.new("B1\t1+1\nB3\tB3:B4\tCOSH(2*PI())\n") output ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_shared_formulae_spec.rb
Ruby
mit
228
master
2,558
require_relative '../spec_helper' describe RewriteSharedFormulae do it "should take shared formula hash, a shared_target hash, and ouput a set of formula hashes" do formula_shared = { [:Sheet, :B3] => ["B3:C4", "0", [:cell,:A1]], [:Sheet, :Z5] => ["Z5","1", [:cell,:A1]] } formula_shared_tar...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_worksheet_names_spec.rb
Ruby
mit
228
master
813
require_relative '../spec_helper' describe RewriteWorksheetNames do it "should take the results of extract_worksheet_names.rb and extract_relationships.rb and return one line per worksheet: worksheet name then tab then worksheet filename" do extract_worksheet_names_output = StringIO.new("rId1\tOutputs\nrId2\t...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_cell_references_to_include_sheet_spec.rb
Ruby
mit
228
master
1,920
require_relative '../spec_helper' describe RewriteCellReferencesToIncludeSheet do it "should take a file with ast in its last column and rewrite any [:cell, 'A1'] and [:area, 'A1', 'B2'] references to [:sheet_reference, 'sheet1', [:cell, 'A1']]" do input = <<END B2 [:function, "SUM", [:cell, "F4"]] C2 [:function, "...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_values_to_ast_spec.rb
Ruby
mit
228
master
848
require_relative '../spec_helper' describe RewriteValuesToAst do it "should create a flat file with one string per cell, in the format: reference\ttype\tvalue" do input = <<END A1\tb\t1 A2\ts\t0 A3\tn\t1 A4\tn\t3.1415000000000002 A5\te\t#NAME? A6\tstr\tHello AJ5 str Capacity increases up to ~8,5 GW in 205...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_merge_formulae_and_values_spec.rb
Ruby
mit
228
master
1,025
require_relative '../spec_helper' describe RewriteMergeFormulaeAndValues do it "should take files of the different types of formulae and a file of values and combine them into a single file" do values = <<END A1 [:boolean_true] A2 [:string, "Hello"] A3 [:number, "1"] A4 [:number, "3.1415000000000002"] A5 [:error, ...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_relationship_id_to_filename_spec.rb
Ruby
mit
228
master
625
require_relative '../spec_helper' describe RewriteRelationshipIdToFilename do it "should take a relationship file and use it to map the last column of an input file from rIds to filenames" do input = StringIO.new("rId1\nrId2\nrId3\n") relationships = StringIO.new("rId1\tworksheets/sheet1.xml\nrId2\tworksh...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/ast_copy_formula_spec.rb
Ruby
mit
228
master
1,379
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AstCopyFormula do it "should take a specified distance in rows and columns, and move all references by the appropriate ammount" do copy = AstCopyFormula.new copy.rows_to_move = 1 copy.columns_to_move = 1 copy.copy([:cell...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_whole_row_column_references_to_areas_spec.rb
Ruby
mit
228
master
1,006
require_relative '../spec_helper' describe RewriteWholeRowColumnReferencesToAreas do it "should take a hash with sheet names and row and column references and replace them with ranges" do input = test_data('RowAndColumnRanges.ast') default_worksheet_name = :Ranges worksheet_dimensions = {:ValueTypes =...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/rewrite/rewrite_array_formulae_spec.rb
Ruby
mit
228
master
9,764
require_relative '../spec_helper' describe RewriteArrayFormulae do it "should take array formula like 'reference\\array range\\tformula ast\\n' and output normal formulae" do input = { [:Sheet, :B6] => ["B6:B8", [:array, [:row, [:arithmetic, [:cell, :"B3"], [:operato...
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/extract/extract_relationships_spec.rb
Ruby
mit
228
master
315
require_relative '../spec_helper' describe ExtractRelationships do it "should return a series of relationships" do input = excel_fragment 'Relationships.xml' output = ExtractRelationships.extract(input) output.should == { "rId3" => "worksheets/sheet3.xml", "rId4" => "theme/theme1.xml"} end end
github
tamc/excel_to_code
https://github.com/tamc/excel_to_code
spec/extract/extract_shared_strings_spec.rb
Ruby
mit
228
master
361
require_relative '../spec_helper' describe ExtractSharedStrings do it "should create a flat file with one string per row" do input = excel_fragment 'SharedStrings.xml' output = ExtractSharedStrings.extract(input) output.should == [ [:string, "This a second shared string"], [:string, "This is, hopefull...