Merge branch 'maint'
[org-mode.git] / testing / lisp / test-ob-octave.el
blob3d7cf799f873b8e6c0367607c67acd5a79c6bb85
1 ;;; test-ob-octave.el --- tests for ob-octave.el
3 ;; Copyright (c) 2010-2013 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 (org-test-for-executable "octave")
22 (unless (featurep 'ob-octave)
23 (signal 'missing-test-dependency "Support for Octave code blocks"))
25 (ert-deftest ob-octave/input-none ()
26 "Number output"
27 (org-test-at-id "54dcd61d-cf6c-4d7a-b9e5-854953c8a753"
28 (org-babel-next-src-block)
29 (should (= 10 (org-babel-execute-src-block)))))
31 (ert-deftest ob-octave/output-vector ()
32 "Vector output"
33 (org-test-at-id "54dcd61d-cf6c-4d7a-b9e5-854953c8a753"
34 (org-babel-next-src-block 2)
35 (should (equal '((1 2 3 4)) (org-babel-execute-src-block)))))
37 (ert-deftest ob-octave/input-variable ()
38 "Input variable"
39 (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
40 (org-babel-next-src-block)
41 (should (= 42 (org-babel-execute-src-block)))))
43 (ert-deftest ob-octave/input-array ()
44 "Input an array"
45 (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
46 (org-babel-next-src-block 2)
47 (should (equal '((1 2 3)) (org-babel-execute-src-block)))))
49 (ert-deftest ob-octave/input-matrix ()
50 "Input a matrix"
51 (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
52 (org-babel-next-src-block 3)
53 (should (equal '((1 2) (3 4)) (org-babel-execute-src-block)))))
55 (ert-deftest ob-octave/input-string ()
56 "Input a string"
57 (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
58 (org-babel-next-src-block 4)
59 (should (equal "te" (org-babel-execute-src-block)))))
61 (ert-deftest ob-octave/input-nil ()
62 "Input elisp nil"
63 (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
64 (org-babel-next-src-block 5)
65 (should (equal nil (org-babel-execute-src-block)))))