Compare commits

..

10 Commits

  1. 17
      src/rustint/core.clj
  2. 70
      test/rustint/core_test.clj

@ -2179,7 +2179,7 @@
) )
(defn get-rust-formatters [s] (defn get-rust-formatters [s]
(map last (re-seq #"\{:?(.\d)?\}" s)) (map last (re-seq #"\{:?(.\d+)?\}" s))
) )
(defn convertir-formato-impresion [args] (defn convertir-formato-impresion [args]
@ -2189,7 +2189,20 @@
(rest args) (rest args)
(get-rust-formatters (first args)) (get-rust-formatters (first args))
) )
] args) ] (if (empty? clojure-fspecifiers)
args
(into
(rest args)
(list (clojure.string/join
(interleave
(clojure.string/split (first args) #"\{:?(\.\d+)?\}")
(concat clojure-fspecifiers '(""))
)
))
)
)
)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@ -287,6 +287,76 @@
) )
) )
(deftest convertir-formato-impresion-04
(testing "Test 04 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("Hola, mundo {}!" 2.0))
'("Hola, mundo %.0f!" 2.0)
)
)
)
)
(deftest convertir-formato-impresion-05
(testing "Test 05 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("Hola, mundo {}!" "2"))
'("Hola, mundo %s!" "2")
)
)
)
)
(deftest convertir-formato-impresion-06
(testing "Test 06 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("Hola, mundo {} {} {}!" 2 2.0 "2"))
'("Hola, mundo %d %.0f %s!" 2 2.0 "2")
)
)
)
)
(deftest convertir-formato-impresion-07
(testing "Test 07 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("Hola, mundo {:.8}!" 2.0))
'("Hola, mundo %.8f!" 2.0)
)
)
)
)
(deftest convertir-formato-impresion-08
(testing "Test 08 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("- My name is {}, James {}.\n- Hello, {}{}{}!" "Bond" "Bond" 0 0 7))
'("- My name is %s, James %s.\n- Hello, %d%d%d!" "Bond" "Bond" 0 0 7)
)
)
)
)
(deftest convertir-formato-impresion-09
(testing "Test 09 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("{} elevado a la {} es\t{}" 2.0 2 4.0))
'("%.0f elevado a la %d es\t%.0f" 2.0 2 4.0)
)
)
)
)
(deftest convertir-formato-impresion-10
(testing "Test 10 convertir-formato-impresion"
(is (=
(convertir-formato-impresion '("Las raices cuadradas de {} son +{:.8} y -{:.8}" 4.0 1.999999999985448 1.999999999985448))
'("Las raices cuadradas de %.0f son +%.8f y -%.8f" 4.0 1.999999999985448 1.999999999985448)
)
)
)
)
(deftest get-rust-formatters-01 (deftest get-rust-formatters-01
(testing "Test 01 get-rust-formatters" (testing "Test 01 get-rust-formatters"
(is (= (is (=

Loading…
Cancel
Save