File: err_test.rb

package info (click to toggle)
ruby-gsl 2.1.0.3%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,604 kB
  • sloc: ansic: 62,050; ruby: 15,845; sh: 19; makefile: 10
file content (23 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'test_helper'

class ErrTest < GSL::TestCase

  MAX_ERRS = 64

  ERRORS = %w[
    SUCCESS FAILURE CONTINUE EDOM ERANGE EFAULT EINVAL EFAILED
    EFACTOR ESANITY ENOMEM EBADFUNC ERUNAWAY EMAXITER EZERODIV
    EBADTOL ETOL EUNDRFLW EOVRFLW ELOSS EROUND EBADLEN ENOTSQR
    ESING EDIVERGE EUNSUP EUNIMPL ECACHE ETABLE ENOPROG ENOPROGJ
    ETOLF ETOLX ETOLG EOF
  ].map { |name| GSL.const_get(name) }

  def test_number
    assert ERRORS.uniq == ERRORS
  end

  def test_message
    assert ERRORS.map { |e| GSL.strerror(e) }.uniq.size == ERRORS.size
  end

end