test-ob-C.el 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ;;; test-ob-awk.el --- tests for ob-awk.el
  2. ;; Copyright (c) 2010-2012 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 <http://www.gnu.org/licenses/>.
  15. ;;; Code:
  16. (unless (featurep 'ob-C)
  17. (signal 'missing-test-dependency "Support for C code blocks"))
  18. (ert-deftest ob-C/assert ()
  19. (should t))
  20. (ert-deftest ob-C/simple-program ()
  21. "Hello world program."
  22. (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
  23. (org-babel-next-src-block)
  24. (should (= 42 (org-babel-execute-src-block)))))
  25. (ert-deftest ob-C/integer-var ()
  26. "Test of an integer variable."
  27. (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
  28. (org-babel-next-src-block 2)
  29. (should (= 12 (org-babel-execute-src-block)))))
  30. (ert-deftest ob-C/two-integer-var ()
  31. "Test of two input variables"
  32. (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
  33. (org-babel-next-src-block 3)
  34. (should (= 22 (org-babel-execute-src-block)))))
  35. (ert-deftest ob-C/string-var ()
  36. "Test of a string input variable"
  37. (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
  38. (org-babel-next-src-block 4)
  39. (should (equal "word 4" (org-babel-execute-src-block)))))
  40. (ert-deftest ob-C/preprocessor ()
  41. "Test of a string variable"
  42. (org-test-at-id "fa6db330-e960-4ea2-ac67-94bb845b8577"
  43. (org-babel-next-src-block 5)
  44. (should (= 42 (org-babel-execute-src-block)))))
  45. (ert-deftest ob-C/table ()
  46. "Test of a table output"
  47. :expected-result :failed
  48. (org-test-at-id "2df1ab83-3fa3-462a-a1f3-3aef6044a874"
  49. (org-babel-next-src-block)
  50. (should (equal '((1) (2)) (org-babel-execute-src-block)))))
  51. ;;; test-ob-C.el ends here