[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr 9c91e0dc07 18/84: test: Add test for float scala
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr 9c91e0dc07 18/84: test: Add test for float scalar key-value pairs |
Date: |
Tue, 3 May 2022 09:58:08 -0400 (EDT) |
branch: externals/tomelr
commit 9c91e0dc07291aae8a8b2b4dd1cea52583165e14
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
test: Add test for float scalar key-value pairs
---
README.org | 64 +++++++++++++++++++++++++++++----------------------------
test/tscalar.el | 21 +++++++++++++++++++
2 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/README.org b/README.org
index 10368005c4..176979b7ed 100644
--- a/README.org
+++ b/README.org
@@ -22,8 +22,8 @@ specification defined below.
- [-] Scalar
- [X] Boolean
- [X] Integer
+ - [X] Float
- [ ] String
- - [ ] Float
- [ ] Date + Time with Offset
- [ ] Date
- [ ] Nil
@@ -104,29 +104,8 @@ int4 = -17
: "int3": 0,
: "int4": -17
: }
-*** String
-https://toml.io/en/v1.0.0#string
-**** S-expression
-#+begin_src emacs-lisp :eval no :noweb-ref scalar-string
-'((str . "Roses are red\nViolets are blue"))
-#+end_src
-**** TOML
-#+begin_src toml
-str = """
-Roses are red
-Violets are blue"""
-#+end_src
-**** JSON Reference
-#+begin_src emacs-lisp :noweb yes :exports results
-(json-encode-pretty
- <<scalar-string>>)
-#+end_src
-
-#+RESULTS:
-: {
-: "str": "Roses are red\nViolets are blue"
-: }
-*** Float
+*** DONE Float
+CLOSED: [2022-04-28 Thu 17:29]
https://toml.io/en/v1.0.0#float
**** S-expression
#+begin_src emacs-lisp :eval no :noweb-ref scalar-float
@@ -139,18 +118,19 @@ https://toml.io/en/v1.0.0#float
(flt7 . 6.626e-34))
#+end_src
**** TOML
+#+begin_src emacs-lisp :noweb yes :exports results :wrap src toml
+(tomelr-encode
+ <<scalar-float>>)
+#+end_src
+
+#+RESULTS:
#+begin_src toml
-# fractional
flt1 = 1.0
flt2 = 3.1415
flt3 = -0.01
-
-# exponent
flt4 = 5e+22
-flt5 = 1e06
-flt6 = -2E-2
-
-# both
+flt5 = 1000000.0
+flt6 = -0.02
flt7 = 6.626e-34
#+end_src
**** JSON Reference
@@ -169,6 +149,28 @@ flt7 = 6.626e-34
: "flt6": -0.02,
: "flt7": 6.626e-34
: }
+*** String
+https://toml.io/en/v1.0.0#string
+**** S-expression
+#+begin_src emacs-lisp :eval no :noweb-ref scalar-string
+'((str . "Roses are red\nViolets are blue"))
+#+end_src
+**** TOML
+#+begin_src toml
+str = """
+Roses are red
+Violets are blue"""
+#+end_src
+**** JSON Reference
+#+begin_src emacs-lisp :noweb yes :exports results
+(json-encode-pretty
+ <<scalar-string>>)
+#+end_src
+
+#+RESULTS:
+: {
+: "str": "Roses are red\nViolets are blue"
+: }
*** Date + Time with Offset
https://toml.io/en/v1.0.0#offset-date-time
**** S-expression
diff --git a/test/tscalar.el b/test/tscalar.el
index b3cbe62137..a052eff7db 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -53,5 +53,26 @@
(push (tomelr-encode el) out))
(should (equal ref (nreverse out)))))
+;;;; Scalar - Float
+(ert-deftest test-scalar-float ()
+ (let ((inp '(((float1 . +1.0))
+ ((float2 . 3.1415))
+ ((float3 . -0.01))
+ ((float4 . 5e+22))
+ ((float5 . 1e06))
+ ((float6 . -2E-2))
+ ((float7 . 6.626e-34))))
+ (ref '("float1 = 1.0"
+ "float2 = 3.1415"
+ "float3 = -0.01"
+ "float4 = 5e+22"
+ "float5 = 1000000.0"
+ "float6 = -0.02"
+ "float7 = 6.626e-34"))
+ out)
+ (dolist (el inp)
+ (push (tomelr-encode el) out))
+ (should (equal ref (nreverse out)))))
+
(provide 'tscalar)
- [elpa] externals/tomelr 732140041e 07/84: doc: Discover `json-encoding-pretty-print` variable!, (continued)
- [elpa] externals/tomelr 732140041e 07/84: doc: Discover `json-encoding-pretty-print` variable!, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr d96a3b235b 04/84: doc: Add LOGBOOK drawer example, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 05d2cafcd9 09/84: test: Add test for boolean scalar key-value pairs, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 2ea3b5e032 03/84: fix!: Set boolean false using :false value, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 28642f2e78 05/84: fix: dates will be strings in Lisp, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 52dc93201d 08/84: feat: First cut -- Port json-encode from json.el to tomelr-encode, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 7cd15e79b8 10/84: tool(ci): Add GHA setup, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr c872e9efc1 17/84: test: Add test for integer scalar key-value pairs, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a1f434f03a 31/84: feat: Support nested TOML tables, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 6bbe740e52 28/84: test: Test that 'false is also considered as boolean false in TOML, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 9c91e0dc07 18/84: test: Add test for float scalar key-value pairs,
ELPA Syncer <=
- [elpa] externals/tomelr 96c890a68b 23/84: feat: Convert Lisp lists to TOML arrays, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr bb85106ee9 27/84: doc: Add spec for nested tables and arrays of tables, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 1d65064ffa 20/84: feat: Recognize local date format YYYY-MM-DD, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 2810504e84 32/84: feat: Add basic support for S-exp plists -> TOML conversion, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 0f4e7b4f2c 47/84: fix: Better detection of nested TTA, but still wip, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr cff1f8aa89 38/84: fix: Support TOML tables arrays specified as plist vector, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 4c419bcee2 37/84: fix: Support TOML tables specified as plists, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr baf81228bc 45/84: fix: Correct the spec for nested array of tables, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 4dda8e6be3 46/84: chore: Style edits in a test, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 5959b90ffa 44/84: fix: Don't let TOML tables be recognized as TOML tables arrays, ELPA Syncer, 2022/05/03