|
1 |
| -describe Daru::Accessors::GSLWrapper do |
2 |
| - before :each do |
3 |
| - @stub_context = Object.new |
4 |
| - @gsl_wrapper = Daru::Accessors::GSLWrapper.new([1,2,3,4,5,6], @stub_context) |
5 |
| - end |
| 1 | +if Daru.has_gsl? |
| 2 | + describe Daru::Accessors::GSLWrapper do |
| 3 | + before :each do |
| 4 | + @stub_context = Object.new |
| 5 | + @gsl_wrapper = Daru::Accessors::GSLWrapper.new([1,2,3,4,5,6], @stub_context) |
| 6 | + end |
6 | 7 |
|
7 |
| - context ".new" do |
8 |
| - it "actually creates a GSL Vector" do |
9 |
| - expect(@gsl_wrapper.data.class).to eq(GSL::Vector) |
| 8 | + context ".new" do |
| 9 | + it "actually creates a GSL Vector" do |
| 10 | + expect(@gsl_wrapper.data.class).to eq(GSL::Vector) |
| 11 | + end |
10 | 12 | end
|
11 |
| - end |
12 | 13 |
|
13 |
| - context "#mean" do |
14 |
| - it "computes mean" do |
15 |
| - expect(@gsl_wrapper.mean).to eq(3.5) |
| 14 | + context "#mean" do |
| 15 | + it "computes mean" do |
| 16 | + expect(@gsl_wrapper.mean).to eq(3.5) |
| 17 | + end |
16 | 18 | end
|
17 |
| - end |
18 | 19 |
|
19 |
| - context "#map!" do |
20 |
| - it "destructively maps" do |
21 |
| - expect(@gsl_wrapper.map! { |a| a += 1 }).to eq( |
22 |
| - Daru::Accessors::GSLWrapper.new([2,3,4,5,6,7], @stub_context) |
23 |
| - ) |
| 20 | + context "#map!" do |
| 21 | + it "destructively maps" do |
| 22 | + expect(@gsl_wrapper.map! { |a| a += 1 }).to eq( |
| 23 | + Daru::Accessors::GSLWrapper.new([2,3,4,5,6,7], @stub_context) |
| 24 | + ) |
| 25 | + end |
24 | 26 | end
|
25 |
| - end |
26 | 27 |
|
27 |
| - context "#delete_at" do |
28 |
| - it "deletes at key" do |
29 |
| - expect(@gsl_wrapper.delete_at(2)).to eq(3) |
| 28 | + context "#delete_at" do |
| 29 | + it "deletes at key" do |
| 30 | + expect(@gsl_wrapper.delete_at(2)).to eq(3) |
30 | 31 |
|
31 |
| - expect(@gsl_wrapper).to eq( |
32 |
| - Daru::Accessors::GSLWrapper.new([1,2,4,5,6], @stub_context) |
33 |
| - ) |
| 32 | + expect(@gsl_wrapper).to eq( |
| 33 | + Daru::Accessors::GSLWrapper.new([1,2,4,5,6], @stub_context) |
| 34 | + ) |
| 35 | + end |
34 | 36 | end
|
35 |
| - end |
36 | 37 |
|
37 |
| - context "#index" do |
38 |
| - it "returns index of value" do |
39 |
| - expect(@gsl_wrapper.index(3)).to eq(2) |
| 38 | + context "#index" do |
| 39 | + it "returns index of value" do |
| 40 | + expect(@gsl_wrapper.index(3)).to eq(2) |
| 41 | + end |
40 | 42 | end
|
41 |
| - end |
42 | 43 |
|
43 |
| - context "#push" do |
44 |
| - it "appends element" do |
45 |
| - expect(@gsl_wrapper.push(15)).to eq( |
46 |
| - Daru::Accessors::GSLWrapper.new([1,2,3,4,5,6,15], @stub_context) |
47 |
| - ) |
| 44 | + context "#push" do |
| 45 | + it "appends element" do |
| 46 | + expect(@gsl_wrapper.push(15)).to eq( |
| 47 | + Daru::Accessors::GSLWrapper.new([1,2,3,4,5,6,15], @stub_context) |
| 48 | + ) |
| 49 | + end |
48 | 50 | end
|
49 | 51 | end
|
50 | 52 | end
|
| 53 | + |
0 commit comments