test-org-table: Tiny refactoring
* testing/lisp/test-org-table.el (test-org-table/org-table-make-reference/mode-string-EL): (test-org-table/org-table-make-reference/mode-string-E): (test-org-table/org-table-make-reference/mode-string-EN): (test-org-table/org-table-make-reference/mode-string-L): (test-org-table/org-table-make-reference/mode-string-none): (test-org-table/org-table-make-reference/mode-string-N): Tiny refactoring.
This commit is contained in:
parent
ef2485e7ce
commit
2fb65b73b6
|
@ -730,138 +730,132 @@ See also http://orgmode.org/worg/org-tutorials/org-lookups.html ."
|
|||
"$3 = '(+ 1 (length (org-lookup-all $2 '(@I$2..@>$2) nil '<))); N"))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-make-reference/mode-string-EL ()
|
||||
(fset 'f 'org-table-make-reference)
|
||||
;; For Lisp formula only
|
||||
(should (equal "0" (f "0" t nil 'literal)))
|
||||
(should (equal "z" (f "z" t nil 'literal)))
|
||||
(should (equal "" (f "" t nil 'literal)))
|
||||
(should (equal "0 1" (f '("0" "1") t nil 'literal)))
|
||||
(should (equal "z 1" (f '("z" "1") t nil 'literal)))
|
||||
(should (equal " 1" (f '("" "1") t nil 'literal)))
|
||||
(should (equal " " (f '("" "" ) t nil 'literal))))
|
||||
(should (equal "0" (org-table-make-reference "0" t nil 'literal)))
|
||||
(should (equal "z" (org-table-make-reference "z" t nil 'literal)))
|
||||
(should (equal "" (org-table-make-reference "" t nil 'literal)))
|
||||
(should (equal "0 1" (org-table-make-reference '("0" "1") t nil 'literal)))
|
||||
(should (equal "z 1" (org-table-make-reference '("z" "1") t nil 'literal)))
|
||||
(should (equal " 1" (org-table-make-reference '("" "1") t nil 'literal)))
|
||||
(should (equal " " (org-table-make-reference '("" "") t nil 'literal))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-make-reference/mode-string-E ()
|
||||
(fset 'f 'org-table-make-reference)
|
||||
;; For Lisp formula
|
||||
(should (equal "\"0\"" (f "0" t nil t)))
|
||||
(should (equal "\"z\"" (f "z" t nil t)))
|
||||
(should (equal "\"\"" (f "" t nil t)))
|
||||
(should (equal "\"0\" \"1\"" (f '("0" "1") t nil t)))
|
||||
(should (equal "\"z\" \"1\"" (f '("z" "1") t nil t)))
|
||||
(should (equal "\"\" \"1\"" (f '("" "1") t nil t)))
|
||||
(should (equal "\"\" \"\"" (f '("" "" ) t nil t)))
|
||||
(should (equal "\"0\"" (org-table-make-reference "0" t nil t)))
|
||||
(should (equal "\"z\"" (org-table-make-reference "z" t nil t)))
|
||||
(should (equal"\"\"" (org-table-make-reference "" t nil t)))
|
||||
(should (equal "\"0\" \"1\"" (org-table-make-reference '("0""1") t nil t)))
|
||||
(should (equal "\"z\" \"1\"" (org-table-make-reference '("z""1") t nil t)))
|
||||
(should (equal"\"\" \"1\"" (org-table-make-reference '("""1") t nil t)))
|
||||
(should (equal"\"\" \"\""(org-table-make-reference '("""" ) t nil t)))
|
||||
;; For Calc formula
|
||||
(should (equal "(0)" (f "0" t nil nil)))
|
||||
(should (equal "(z)" (f "z" t nil nil)))
|
||||
(should (equal "nan" (f "" t nil nil)))
|
||||
(should (equal "[0,1]" (f '("0" "1") t nil nil)))
|
||||
(should (equal "[z,1]" (f '("z" "1") t nil nil)))
|
||||
(should (equal "[nan,1]" (f '("" "1") t nil nil)))
|
||||
(should (equal "[nan,nan]" (f '("" "" ) t nil nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "0" t nil nil)))
|
||||
(should (equal "(z)" (org-table-make-reference "z" t nil nil)))
|
||||
(should (equal "nan" (org-table-make-reference "" t nil nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("0" "1") t nil nil)))
|
||||
(should (equal "[z,1]" (org-table-make-reference '("z" "1") t nil nil)))
|
||||
(should (equal "[nan,1]" (org-table-make-reference '("" "1") t nil nil)))
|
||||
(should (equal "[nan,nan]" (org-table-make-reference '("" "") t nil nil)))
|
||||
;; For Calc formula, special numbers
|
||||
(should (equal "(nan)" (f "nan" t nil nil)))
|
||||
(should (equal "(uinf)" (f "uinf" t nil nil)))
|
||||
(should (equal "(-inf)" (f "-inf" t nil nil)))
|
||||
(should (equal "(inf)" (f "inf" t nil nil)))
|
||||
(should (equal "[nan,1]" (f '( "nan" "1") t nil nil)))
|
||||
(should (equal "[uinf,1]" (f '("uinf" "1") t nil nil)))
|
||||
(should (equal "[-inf,1]" (f '("-inf" "1") t nil nil)))
|
||||
(should (equal "[inf,1]" (f '( "inf" "1") t nil nil))))
|
||||
(should (equal "(nan)" (org-table-make-reference "nan" t nil nil)))
|
||||
(should (equal "(uinf)" (org-table-make-reference "uinf" t nil nil)))
|
||||
(should (equal "(-inf)" (org-table-make-reference "-inf" t nil nil)))
|
||||
(should (equal "(inf)" (org-table-make-reference "inf" t nil nil)))
|
||||
(should (equal "[nan,1]" (org-table-make-reference '("nan" "1") t nil nil)))
|
||||
(should (equal "[uinf,1]" (org-table-make-reference '("uinf" "1") t nil nil)))
|
||||
(should (equal "[-inf,1]" (org-table-make-reference '("-inf" "1") t nil nil)))
|
||||
(should (equal "[inf,1]" (org-table-make-reference '("inf" "1") t nil nil))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-make-reference/mode-string-EN ()
|
||||
(fset 'f 'org-table-make-reference)
|
||||
;; For Lisp formula
|
||||
(should (equal "0" (f "0" t t t)))
|
||||
(should (equal "0" (f "z" t t t)))
|
||||
(should (equal "0" (f "" t t t)))
|
||||
(should (equal "0 1" (f '("0" "1") t t t)))
|
||||
(should (equal "0 1" (f '("z" "1") t t t)))
|
||||
(should (equal "0 1" (f '("" "1") t t t)))
|
||||
(should (equal "0 0" (f '("" "" ) t t t)))
|
||||
(should (equal "0" (org-table-make-reference "0" t t t)))
|
||||
(should (equal "0" (org-table-make-reference "z" t t t)))
|
||||
(should (equal "0" (org-table-make-reference "" t t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("0" "1") t t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("z" "1") t t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("" "1") t t t)))
|
||||
(should (equal "0 0" (org-table-make-reference '("" "" ) t t t)))
|
||||
;; For Calc formula
|
||||
(should (equal "(0)" (f "0" t t nil)))
|
||||
(should (equal "(0)" (f "z" t t nil)))
|
||||
(should (equal "(0)" (f "" t t nil)))
|
||||
(should (equal "[0,1]" (f '("0" "1") t t nil)))
|
||||
(should (equal "[0,1]" (f '("z" "1") t t nil)))
|
||||
(should (equal "[0,1]" (f '("" "1") t t nil)))
|
||||
(should (equal "[0,0]" (f '("" "" ) t t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "0" t t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "z" t t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "" t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("0" "1") t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("z" "1") t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("" "1") t t nil)))
|
||||
(should (equal "[0,0]" (org-table-make-reference '("" "" ) t t nil)))
|
||||
;; For Calc formula, special numbers
|
||||
(should (equal "(0)" (f "nan" t t nil)))
|
||||
(should (equal "(0)" (f "uinf" t t nil)))
|
||||
(should (equal "(0)" (f "-inf" t t nil)))
|
||||
(should (equal "(0)" (f "inf" t t nil)))
|
||||
(should (equal "[0,1]" (f '( "nan" "1") t t nil)))
|
||||
(should (equal "[0,1]" (f '("uinf" "1") t t nil)))
|
||||
(should (equal "[0,1]" (f '("-inf" "1") t t nil)))
|
||||
(should (equal "[0,1]" (f '( "inf" "1") t t nil))))
|
||||
(should (equal "(0)" (org-table-make-reference "nan" t t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "uinf" t t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "-inf" t t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "inf" t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '( "nan" "1") t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("uinf" "1") t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("-inf" "1") t t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '( "inf" "1") t t nil))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-make-reference/mode-string-L ()
|
||||
(fset 'f 'org-table-make-reference)
|
||||
;; For Lisp formula only
|
||||
(should (equal "0" (f "0" nil nil 'literal)))
|
||||
(should (equal "z" (f "z" nil nil 'literal)))
|
||||
(should (equal "" (f "" nil nil 'literal)))
|
||||
(should (equal "0 1" (f '("0" "1") nil nil 'literal)))
|
||||
(should (equal "z 1" (f '("z" "1") nil nil 'literal)))
|
||||
(should (equal "1" (f '("" "1") nil nil 'literal)))
|
||||
(should (equal "" (f '("" "" ) nil nil 'literal))))
|
||||
(should (equal "0" (org-table-make-reference "0" nil nil 'literal)))
|
||||
(should (equal "z" (org-table-make-reference "z" nil nil 'literal)))
|
||||
(should (equal "" (org-table-make-reference "" nil nil 'literal)))
|
||||
(should (equal "0 1" (org-table-make-reference '("0" "1") nil nil 'literal)))
|
||||
(should (equal "z 1" (org-table-make-reference '("z" "1") nil nil 'literal)))
|
||||
(should (equal "1" (org-table-make-reference '("" "1") nil nil 'literal)))
|
||||
(should (equal "" (org-table-make-reference '("" "" ) nil nil 'literal))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-make-reference/mode-string-none ()
|
||||
(fset 'f 'org-table-make-reference)
|
||||
;; For Lisp formula
|
||||
(should (equal "\"0\"" (f "0" nil nil t)))
|
||||
(should (equal "\"z\"" (f "z" nil nil t)))
|
||||
(should (equal "" (f "" nil nil t)))
|
||||
(should (equal "\"0\" \"1\"" (f '("0" "1") nil nil t)))
|
||||
(should (equal "\"z\" \"1\"" (f '("z" "1") nil nil t)))
|
||||
(should (equal "\"1\"" (f '("" "1") nil nil t)))
|
||||
(should (equal "" (f '("" "" ) nil nil t)))
|
||||
(should (equal "\"0\"" (org-table-make-reference "0" nil nil t)))
|
||||
(should (equal "\"z\"" (org-table-make-reference "z" nil nil t)))
|
||||
(should (equal "" (org-table-make-reference "" nil nil t)))
|
||||
(should (equal "\"0\" \"1\"" (org-table-make-reference '("0" "1") nil nil t)))
|
||||
(should (equal "\"z\" \"1\"" (org-table-make-reference '("z" "1") nil nil t)))
|
||||
(should (equal "\"1\"" (org-table-make-reference '("" "1") nil nil t)))
|
||||
(should (equal "" (org-table-make-reference '("" "" ) nil nil t)))
|
||||
;; For Calc formula
|
||||
(should (equal "(0)" (f "0" nil nil nil)))
|
||||
(should (equal "(z)" (f "z" nil nil nil)))
|
||||
(should (equal "(0)" (f "" nil nil nil)))
|
||||
(should (equal "[0,1]" (f '("0" "1") nil nil nil)))
|
||||
(should (equal "[z,1]" (f '("z" "1") nil nil nil)))
|
||||
(should (equal "[1]" (f '("" "1") nil nil nil)))
|
||||
(should (equal "[]" (f '("" "" ) nil nil nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "0" nil nil nil)))
|
||||
(should (equal "(z)" (org-table-make-reference "z" nil nil nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "" nil nil nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("0" "1") nil nil nil)))
|
||||
(should (equal "[z,1]" (org-table-make-reference '("z" "1") nil nil nil)))
|
||||
(should (equal "[1]" (org-table-make-reference '("" "1") nil nil nil)))
|
||||
(should (equal "[]" (org-table-make-reference '("" "" ) nil nil nil)))
|
||||
;; For Calc formula, special numbers
|
||||
(should (equal "(nan)" (f "nan" nil nil nil)))
|
||||
(should (equal "(uinf)" (f "uinf" nil nil nil)))
|
||||
(should (equal "(-inf)" (f "-inf" nil nil nil)))
|
||||
(should (equal "(inf)" (f "inf" nil nil nil)))
|
||||
(should (equal "[nan,1]" (f '( "nan" "1") nil nil nil)))
|
||||
(should (equal "[uinf,1]" (f '("uinf" "1") nil nil nil)))
|
||||
(should (equal "[-inf,1]" (f '("-inf" "1") nil nil nil)))
|
||||
(should (equal "[inf,1]" (f '( "inf" "1") nil nil nil))))
|
||||
(should (equal "(nan)" (org-table-make-reference "nan" nil nil nil)))
|
||||
(should (equal "(uinf)" (org-table-make-reference "uinf" nil nil nil)))
|
||||
(should (equal "(-inf)" (org-table-make-reference "-inf" nil nil nil)))
|
||||
(should (equal "(inf)" (org-table-make-reference "inf" nil nil nil)))
|
||||
(should (equal "[nan,1]" (org-table-make-reference '( "nan" "1") nil nil nil)))
|
||||
(should (equal "[uinf,1]" (org-table-make-reference '("uinf" "1") nil nil nil)))
|
||||
(should (equal "[-inf,1]" (org-table-make-reference '("-inf" "1") nil nil nil)))
|
||||
(should (equal "[inf,1]" (org-table-make-reference '( "inf" "1") nil nil nil))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-make-reference/mode-string-N ()
|
||||
(fset 'f 'org-table-make-reference)
|
||||
;; For Lisp formula
|
||||
(should (equal "0" (f "0" nil t t)))
|
||||
(should (equal "0" (f "z" nil t t)))
|
||||
(should (equal "" (f "" nil t t)))
|
||||
(should (equal "0 1" (f '("0" "1") nil t t)))
|
||||
(should (equal "0 1" (f '("z" "1") nil t t)))
|
||||
(should (equal "1" (f '("" "1") nil t t)))
|
||||
(should (equal "" (f '("" "" ) nil t t)))
|
||||
(should (equal "0" (org-table-make-reference "0" nil t t)))
|
||||
(should (equal "0" (org-table-make-reference "z" nil t t)))
|
||||
(should (equal "" (org-table-make-reference "" nil t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("0" "1") nil t t)))
|
||||
(should (equal "0 1" (org-table-make-reference '("z" "1") nil t t)))
|
||||
(should (equal "1" (org-table-make-reference '("" "1") nil t t)))
|
||||
(should (equal "" (org-table-make-reference '("" "" ) nil t t)))
|
||||
;; For Calc formula
|
||||
(should (equal "(0)" (f "0" nil t nil)))
|
||||
(should (equal "(0)" (f "z" nil t nil)))
|
||||
(should (equal "(0)" (f "" nil t nil)))
|
||||
(should (equal "[0,1]" (f '("0" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (f '("z" "1") nil t nil)))
|
||||
(should (equal "[1]" (f '("" "1") nil t nil)))
|
||||
(should (equal "[]" (f '("" "" ) nil t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "0" nil t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "z" nil t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "" nil t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("0" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("z" "1") nil t nil)))
|
||||
(should (equal "[1]" (org-table-make-reference '("" "1") nil t nil)))
|
||||
(should (equal "[]" (org-table-make-reference '("" "" ) nil t nil)))
|
||||
;; For Calc formula, special numbers
|
||||
(should (equal "(0)" (f "nan" nil t nil)))
|
||||
(should (equal "(0)" (f "uinf" nil t nil)))
|
||||
(should (equal "(0)" (f "-inf" nil t nil)))
|
||||
(should (equal "(0)" (f "inf" nil t nil)))
|
||||
(should (equal "[0,1]" (f '( "nan" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (f '("uinf" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (f '("-inf" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (f '( "inf" "1") nil t nil))))
|
||||
(should (equal "(0)" (org-table-make-reference "nan" nil t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "uinf" nil t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "-inf" nil t nil)))
|
||||
(should (equal "(0)" (org-table-make-reference "inf" nil t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '( "nan" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("uinf" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '("-inf" "1") nil t nil)))
|
||||
(should (equal "[0,1]" (org-table-make-reference '( "inf" "1") nil t nil))))
|
||||
|
||||
(ert-deftest test-org-table/org-table-convert-refs-to-an/1 ()
|
||||
"Simple reference @2$1."
|
||||
|
|
Loading…
Reference in New Issue