Makefile: show ORG_MAKE_DOC in `configĀ“
[org-mode.git] / testing / lisp / test-ob-fortran.el
blobc18cb64d13d50fe5dc0696fd765a1efd88ec026a
1 ;;; test-ob-fortran.el --- tests for ob-fortran.el
3 ;; Copyright (c) 2010-2012 Sergey Litvinov
4 ;; Authors: Sergey Litvinov
6 ;; Released under the GNU General Public License version 3
7 ;; see: http://www.gnu.org/licenses/gpl-3.0.html
9 ;;; Code:
10 (org-test-for-executable "gfortran")
11 (unless (featurep 'ob-fortran)
12 (signal 'missing-test-dependency "Support for Fortran code blocks"))
14 (ert-deftest ob-fortran/assert ()
15 (should t))
17 (ert-deftest ob-fortran/simple-program ()
18 "Test of hello world program."
19 (org-test-at-id "459384e8-1797-4f11-867e-dde0473ea7cc"
20 (org-babel-next-src-block)
21 (should (equal "Hello world" (org-babel-execute-src-block)))))
23 (ert-deftest ob-fortran/fortran-var-program ()
24 "Test a fortran variable"
25 (org-test-at-id "459384e8-1797-4f11-867e-dde0473ea7cc"
26 (org-babel-next-src-block 2)
27 (should (= 10 (org-babel-execute-src-block)))))
29 (ert-deftest ob-fortran/input-var ()
30 "Test :var"
31 (org-test-at-id "d8d1dfd3-5f0c-48fe-b55d-777997e02242"
32 (org-babel-next-src-block)
33 (should (= 15 (org-babel-execute-src-block)))))
35 (ert-deftest ob-fortran/preprosessor-var ()
36 "Test preprocessed fortran"
37 (org-test-at-id "d8d1dfd3-5f0c-48fe-b55d-777997e02242"
38 (org-babel-next-src-block 2)
39 (should (= 42 (org-babel-execute-src-block)))))
41 ;; ;; TODO: test fails
42 ;; (ert-deftest ob-fortran/character-var ()
43 ;; "Test string input"
44 ;; (org-test-at-id "d8d1dfd3-5f0c-48fe-b55d-777997e02242"
45 ;; (org-babel-next-src-block 3)
46 ;; (should (equal "word" (org-babel-execute-src-block)))))
48 (ert-deftest ob-fortran/list-var ()
49 "Test real array input"
50 (org-test-at-id "c28569d9-04ce-4cad-ab81-1ea29f691465"
51 (org-babel-next-src-block)
52 (should (equal "1.00 2.00 3.00" (org-babel-execute-src-block)))))
54 (ert-deftest ob-fortran/list-var-from-table ()
55 "Test real array from a table"
56 (org-test-at-id "c28569d9-04ce-4cad-ab81-1ea29f691465"
57 (org-babel-next-src-block 2)
58 (should (equal "1.00 2.00" (org-babel-execute-src-block)))))
60 (ert-deftest ob-fortran/no-variables-with-main ()
61 "Test :var with explicit 'program'"
62 (org-test-at-id "891ead4a-f87a-473c-9ae0-1cf348bcd04f"
63 (org-babel-next-src-block)
64 (should-error (org-babel-execute-src-block))
65 :type 'error))
67 ;; (ert-deftest ob-fortran/wrong-list ()
68 ;; "Test wrong input list"
69 ;; (org-test-at-id "891ead4a-f87a-473c-9ae0-1cf348bcd04f"
70 ;; (org-babel-next-src-block 2)
71 ;; (should-error (org-babel-execute-src-block))
72 ;; :type 'error))
74 ;; (ert-deftest ob-fortran/compiler-flags ()
75 ;; "Test compiler's flags"
76 ;; (org-test-at-id "891ead4a-f87a-473c-9ae0-1cf348bcd04f"
77 ;; (org-babel-next-src-block 3)
78 ;; (should-error (org-babel-execute-src-block))
79 ;; :type 'error))
81 (ert-deftest ob-fortran/command-arguments ()
82 "Test real array from a table"
83 (org-test-at-id "2d5330ea-9934-4737-9ed6-e1d3dae2dfa4"
84 (org-babel-next-src-block)
85 (should (= 23 (org-babel-execute-src-block)))))
87 (provide 'test-ob-fortran)
89 ;;; test-ob-fortran.el ends here