Skip to content

Commit b1de2cf

Browse files
MirceaSttuegel
andauthored
Parse signed hex values (#2258)
* made hex value parsing accept signed values * fixed unit test Co-authored-by: Thomas Tuegel <[email protected]>
1 parent 937e90a commit b1de2cf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kore/src/Kore/Builtin/String.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ evalString2Base = Builtin.functionEvaluator evalString2Base0
305305
[(result, "")] -> Right (result, "")
306306
_ -> Left ""
307307
10 -> Text.signed Text.decimal
308-
16 -> Text.hexadecimal
308+
16 -> Text.signed Text.hexadecimal
309309
_ -> const empty
310310
case readN _str of
311311
Right (result, Text.unpack -> "") ->

kore/test/Test/Kore/Builtin/String.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ test_string2Base =
297297
[asInternal "42", Test.Int.asInternal 16]
298298
(Test.Int.asPattern 66)
299299
, Test.Int.testInt
300-
"string2Base hex negative is bottom"
300+
"string2Base hex negative"
301301
string2BaseStringSymbol
302302
[asInternal "-42", Test.Int.asInternal 16]
303-
bottom
303+
(Test.Int.asPattern (-66))
304304
, Test.Int.testInt
305305
"string2Base hex is bottom"
306306
string2BaseStringSymbol
@@ -317,7 +317,7 @@ test_string2Base =
317317
[asInternal "foobar", Test.Int.asInternal 16]
318318
bottom
319319
, Test.Int.testInt
320-
"string2Base hex from hex is bottom"
320+
"string2Base hex from hex"
321321
string2BaseStringSymbol
322322
[asInternal "baad", Test.Int.asInternal 16]
323323
(Test.Int.asPattern 47789)

0 commit comments

Comments
 (0)