summaryrefslogtreecommitdiff
path: root/modules/fmod/test.el
blob: e1478d88b97779ebf3f3ad9cd6df5b090c67c319 (plain)
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
27
28
29
30
31
(require 'ert)

;; basic module test should go here

(ert-deftest fmod-require ()
  "Tests bindings after require"
  (skip-unless (not (fboundp 'fmod)))
  (require 'fmod)
  (should (fboundp 'fmod)))

(ert-deftest fmod-doc ()
  "Tests docstring"
  ;; core functions docstrings should work
  (should (string= (documentation 'base64-decode-string 'raw) "Base64-decode STRING and return the result.\n\n(fn STRING)"))

  (require 'fmod)

  ;; even after a module was added
  (should (string= (documentation 'base64-decode-string 'raw) "Base64-decode STRING and return the result.\n\n(fn STRING)"))
  ;; check new function doc
  (should (string= (documentation 'fmod 'raw) "Returns the floating-point remainder of NUMER/DENOM\n\n(fn NUMER DENOM)")))

(ert-deftest fmod-value ()
  "Tests fmod calls"
  (require 'fmod)
  (should (= (fmod 3 2) 1))
  ;; XXX: edge cases in man fmod(3)
  ;; (should (= (fmod 3 2) NaN))
  ;; (should (= (fmod inf 1) NaN))
  ;; (should (= (fmod 3 0) NaN))
  )