[openssh-commits] [openssh] 01/01: upstream: Fix long->int for convtime tests here too. Spotted by

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jan 22 16:07:11 AEDT 2021


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 6ffdcdda128045226dda7fbb3956407978028a1e
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date:   Mon Jan 18 11:43:34 2021 +0000

    upstream: Fix long->int for convtime tests here too. Spotted by
    
    tobhe at .
    
    OpenBSD-Regress-ID: a87094f5863312d00938afba771d25f788c849d0
---
 regress/unittests/conversion/tests.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/regress/unittests/conversion/tests.c b/regress/unittests/conversion/tests.c
index ae1154d4..bbdc5f5a 100644
--- a/regress/unittests/conversion/tests.c
+++ b/regress/unittests/conversion/tests.c
@@ -1,4 +1,4 @@
-/* 	$OpenBSD: tests.c,v 1.2 2019/06/14 04:03:48 djm Exp $ */
+/* 	$OpenBSD: tests.c,v 1.3 2021/01/18 11:43:34 dtucker Exp $ */
 /*
  * Regress test for conversions
  *
@@ -26,28 +26,28 @@ tests(void)
 	char buf[1024];
 
 	TEST_START("conversion_convtime");
-	ASSERT_LONG_EQ(convtime("0"), 0);
-	ASSERT_LONG_EQ(convtime("1"), 1);
-	ASSERT_LONG_EQ(convtime("1S"), 1);
+	ASSERT_INT_EQ(convtime("0"), 0);
+	ASSERT_INT_EQ(convtime("1"), 1);
+	ASSERT_INT_EQ(convtime("1S"), 1);
 	/* from the examples in the comment above the function */
-	ASSERT_LONG_EQ(convtime("90m"), 5400);
-	ASSERT_LONG_EQ(convtime("1h30m"), 5400);
-	ASSERT_LONG_EQ(convtime("2d"), 172800);
-	ASSERT_LONG_EQ(convtime("1w"), 604800);
+	ASSERT_INT_EQ(convtime("90m"), 5400);
+	ASSERT_INT_EQ(convtime("1h30m"), 5400);
+	ASSERT_INT_EQ(convtime("2d"), 172800);
+	ASSERT_INT_EQ(convtime("1w"), 604800);
 
 	/* negative time is not allowed */
-	ASSERT_LONG_EQ(convtime("-7"), -1);
-	ASSERT_LONG_EQ(convtime("-9d"), -1);
+	ASSERT_INT_EQ(convtime("-7"), -1);
+	ASSERT_INT_EQ(convtime("-9d"), -1);
 	
 	/* overflow */
-	snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX);
-	ASSERT_LONG_EQ(convtime(buf), -1);
-	snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1);
-	ASSERT_LONG_EQ(convtime(buf), -1);
+	snprintf(buf, sizeof buf, "%llu", (unsigned long long)INT_MAX);
+	ASSERT_INT_EQ(convtime(buf), INT_MAX);
+	snprintf(buf, sizeof buf, "%llu", (unsigned long long)INT_MAX + 1);
+	ASSERT_INT_EQ(convtime(buf), -1);
 
 	/* overflow with multiplier */
-	snprintf(buf, sizeof buf, "%lluM", (unsigned long long)LONG_MAX/60 + 1);
-	ASSERT_LONG_EQ(convtime(buf), -1);
-	ASSERT_LONG_EQ(convtime("1000000000000000000000w"), -1);
+	snprintf(buf, sizeof buf, "%lluM", (unsigned long long)INT_MAX/60 + 1);
+	ASSERT_INT_EQ(convtime(buf), -1);
+	ASSERT_INT_EQ(convtime("1000000000000000000000w"), -1);
 	TEST_DONE();
 }

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list