shithub: kwa

Download patch

ref: 246f891f014fe56d6778f3576b4fa6def8b19bf3
parent: f35a20e9357512dd66f8ff6c4c6b593b681dd276
author: qwx <qwx@sciops.net>
date: Sun Oct 26 13:43:21 EDT 2025

test: add T.fmt, with one single test for now

--- a/test/Compare.T1
+++ b/test/Compare.T1
@@ -9,7 +9,7 @@
 	T.csconcat \
 	T.delete \
 	T.exprconv \
-	T.func \
+	T.fmt \
 	T.getline \
 	T.lilly \
 	T.main \
@@ -26,6 +26,7 @@
 	T.errmsg \
 	T.expr \
 	T.flags \
+	T.func \
 	T.int-expr \
 	T.latin1 \
 	T.misc \
--- /dev/null
+++ b/test/T.fmt
@@ -1,0 +1,19 @@
+#!/bin/rc
+echo T.fmt: OFMT and CONVFMT tests
+
+echo '0.333333
+0.3 0.142857 
+0.33 0.14 0.333333 
+0.33 0.14 0.3333333333  0.1428571429  0.333333 ' >foo1
+$awk '
+BEGIN{
+	print 1/3
+	OFMT="%.1g"
+	print 1/3, 1/7" "
+	OFMT="%.2g"
+	x=1/3" "
+	print 1/3, 1/7, x
+	CONVFMT="%.10f"
+	print 1/3, 1/7, 1/3" ", 1/7" ", x
+}' >foo2
+diff foo1 foo2 || echo >[1=2] 'BAD: T.ofmt: bad conversions'
--