Skip to content

Commit

Permalink
set const ARGMAX_TYPE = UInt32
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausC committed May 26, 2024
1 parent c929cea commit 049e2f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.jl.mem
/Manifest.toml
/docs/build/
/lcov.info
2 changes: 1 addition & 1 deletion src/Scanf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 049e2f5

Please sign in to comment.