File: add_has_gsl_condition_to_complex_integration_spec.patch

package info (click to toggle)
ruby-integration 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 132 kB
  • ctags: 14
  • sloc: ruby: 320; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: add test on has_gsl? before using GSL integration method
 This one was missing from the spec for complex intergration with GSL methods
Author: Cédric Boutillier <boutil@debian.org>
Bug: https://github.com/clbustos/integration/pull/1
Last-Update: 2012-10-17


--- a/spec/integration_spec.rb
+++ b/spec/integration_spec.rb
@@ -17,9 +17,13 @@
     Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:adaptive_quadrature},&normal_pdf).should be_within(1e-11).of(0.341344746068)
   end
   it "should return a correct value for a complex integration with gsl methods" do
-    normal_pdf=lambda {|x| (1/Math.sqrt(2*Math::PI))*Math.exp(-(x**2/2))}
-    Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:qng},&normal_pdf).should be_within(1e-11).of(0.341344746068)
-    Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:qag},&normal_pdf).should be_within(1e-11).of(0.341344746068)
+    if Integration.has_gsl?
+      normal_pdf=lambda {|x| (1/Math.sqrt(2*Math::PI))*Math.exp(-(x**2/2))}
+      Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:qng},&normal_pdf).should be_within(1e-11).of(0.341344746068)
+      Integration.integrate(0,1,{:tolerance=>1e-12,:method=>:qag},&normal_pdf).should be_within(1e-11).of(0.341344746068)
+    else
+      pending("GSL not available")
+    end
   end