Update copyright years again.
[org-mode.git] / testing / lisp / test-ob-C.el
blob42e4dd28d28e1ce7b344ac8e4e142b0269d315af
1 ;;; test-ob-awk.el --- tests for ob-awk.el
3 ;; Copyright (c) 2010-2014 Sergey Litvinov
4 ;; Authors: Sergey Litvinov
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Code:
22 (unless (featurep 'ob-C)
23 (signal 'missing-test-dependency "Support for C code blocks"))
25 (ert-deftest ob-C/assert ()
26 (should t))
28 (ert-deftest ob-C/simple-program ()
29 "Hello world program."
30 (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
31 (org-babel-next-src-block)
32 (should (= 42 (org-babel-execute-src-block)))))
34 (ert-deftest ob-C/integer-var ()
35 "Test of an integer variable."
36 (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
37 (org-babel-next-src-block 2)
38 (should (= 12 (org-babel-execute-src-block)))))
40 (ert-deftest ob-C/two-integer-var ()
41 "Test of two input variables"
42 (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
43 (org-babel-next-src-block 3)
44 (should (= 22 (org-babel-execute-src-block)))))
46 (ert-deftest ob-C/string-var ()
47 "Test of a string input variable"
48 (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
49 (org-babel-next-src-block 4)
50 (should (equal "word 4" (org-babel-execute-src-block)))))
52 (ert-deftest ob-C/preprocessor ()
53 "Test of a string variable"
54 (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
55 (org-babel-next-src-block 5)
56 (should (= 42 (org-babel-execute-src-block)))))
58 (ert-deftest ob-C/table ()
59 "Test of a table output"
60 (org-test-at-id "2df1ab83-3fa3-462a-a1f3-3aef6044a874"
61 (org-babel-next-src-block)
62 (should (equal '((1) (2)) (org-babel-execute-src-block)))))
64 (ert-deftest ob-C/list-var ()
65 "Test of a list input variable"
66 (org-test-at-id "cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5"
67 (org-babel-next-src-block 1)
68 (should (string= "abcdef2" (org-babel-execute-src-block)))))
70 (ert-deftest ob-C/vector-var ()
71 "Test of a vector input variable"
72 (org-test-at-id "cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5"
73 (org-babel-next-src-block 2)
74 (should (equal 122 (org-babel-execute-src-block)))))
76 (ert-deftest ob-C/list-list-var ()
77 "Test of a list list input variable"
78 (org-test-at-id "cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5"
79 (org-babel-next-src-block 3)
80 (should (equal '((1 3) (2 4)) (org-babel-execute-src-block)))))
82 ;;; test-ob-C.el ends here