test-ob-octave.el 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ;;; test-ob-octave.el --- tests for ob-octave.el -*- lexical-binding: t; -*-
  2. ;; Copyright (c) 2010-2014, 2019 Sergey Litvinov
  3. ;; Authors: Sergey Litvinov
  4. ;; This file is not part of GNU Emacs.
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. (org-test-for-executable "octave")
  16. (unless (featurep 'ob-octave)
  17. (signal 'missing-test-dependency "Support for Octave code blocks"))
  18. (ert-deftest ob-octave/input-none ()
  19. "Number output"
  20. (org-test-at-id "54dcd61d-cf6c-4d7a-b9e5-854953c8a753"
  21. (org-babel-next-src-block)
  22. (should (= 10 (org-babel-execute-src-block)))))
  23. (ert-deftest ob-octave/output-vector ()
  24. "Vector output"
  25. (org-test-at-id "54dcd61d-cf6c-4d7a-b9e5-854953c8a753"
  26. (org-babel-next-src-block 2)
  27. (should (equal '((1 2 3 4)) (org-babel-execute-src-block)))))
  28. (ert-deftest ob-octave/input-variable ()
  29. "Input variable"
  30. (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
  31. (org-babel-next-src-block)
  32. (should (= 42 (org-babel-execute-src-block)))))
  33. (ert-deftest ob-octave/input-array ()
  34. "Input an array"
  35. (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
  36. (org-babel-next-src-block 2)
  37. (should (equal '((1 2 3)) (org-babel-execute-src-block)))))
  38. (ert-deftest ob-octave/input-matrix ()
  39. "Input a matrix"
  40. (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
  41. (org-babel-next-src-block 3)
  42. (should (equal '((1 2) (3 4)) (org-babel-execute-src-block)))))
  43. (ert-deftest ob-octave/input-string ()
  44. "Input a string"
  45. (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
  46. (org-babel-next-src-block 4)
  47. (should (equal "te" (org-babel-execute-src-block)))))
  48. (ert-deftest ob-octave/input-nil ()
  49. "Input elisp nil"
  50. (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
  51. (org-babel-next-src-block 5)
  52. (should (equal nil (org-babel-execute-src-block)))))
  53. (provide 'test-ob-octave)