From 049e2f57bcbedb88633cf464fc268d3f86de58b9 Mon Sep 17 00:00:00 2001 From: KlausC Date: Sun, 26 May 2024 23:23:38 +0200 Subject: [PATCH] set `const ARGMAX_TYPE = UInt32` --- .gitignore | 1 + src/Scanf.jl | 2 +- test/runtests.jl | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 20fe29d..f5f7651 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.jl.mem /Manifest.toml /docs/build/ +/lcov.info diff --git a/src/Scanf.jl b/src/Scanf.jl index 4587ead..8e2e870 100644 --- a/src/Scanf.jl +++ b/src/Scanf.jl @@ -5,7 +5,7 @@ using BufferedStreams export @scanf, @sscanf, scanf const EOF = -1 -const ARGNUM_TYPE = UInt16 +const ARGNUM_TYPE = UInt32 const WIDTH_TYPE = UInt32 # whitespace characters in format strings const WHITESPACE = b" \n\t\r\f\v" diff --git a/test/runtests.jl b/test/runtests.jl index 35e71f1..290714c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -232,7 +232,8 @@ using Test, Scanf @test_throws ArgumentError scanf("", f) toobig_argnum = (Int64(typemax(Scanf.ARGNUM_TYPE)) + 1) - @test Scanf.Format("%d"^(toobig_argnum - 1)) isa Scanf.Format + acceptable = min(toobig_argnum-1, 100000) + @test Scanf.Format("%d"^acceptable) isa Scanf.Format @test_throws ArgumentError Scanf.Format("%d"^toobig_argnum) toobig_width = (Int64(typemax(Scanf.WIDTH_TYPE)) + 1)