Skip to content

Commit 701bfa4

Browse files
committed
Add tests for the MAXDIGITS feature.
1 parent ca06832 commit 701bfa4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_utilities.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,21 @@ using Convex: AbstractExpr, ConicObj
137137
termination status: OPTIMAL
138138
primal status: FEASIBLE_POINT
139139
dual status: FEASIBLE_POINT"""
140+
141+
# test small `MAXDIGITS`
142+
x = Variable()
143+
old_maxdigits = Convex.MAXDIGITS[]
144+
Convex.MAXDIGITS[] = 2
145+
@test length(Convex.show_id(x)) == length("id: ") + 5
146+
Convex.MAXDIGITS[] = old_maxdigits
147+
148+
# test large `MAXDIGITS`
149+
x = Variable()
150+
old_maxdigits = Convex.MAXDIGITS[]
151+
Convex.MAXDIGITS[] = 100
152+
@test length(Convex.show_id(x)) == length("id: ") + length(string(x.id_hash))
153+
Convex.MAXDIGITS[] = old_maxdigits
154+
140155
end
141156

142157
@testset "ConicObj with type $T" for T = [UInt32, UInt64]

0 commit comments

Comments
 (0)