|
17 | 17 | package za.co.absa.cobrix.cobol.parser.decoders |
18 | 18 |
|
19 | 19 | import org.scalatest.funsuite.AnyFunSuite |
| 20 | +import za.co.absa.cobrix.cobol.parser.ast.datatype._ |
20 | 21 | import za.co.absa.cobrix.cobol.parser.encoding.{ASCII, EBCDIC} |
| 22 | +import za.co.absa.cobrix.cobol.parser.position |
21 | 23 |
|
22 | 24 | class BinaryDecoderSpec extends AnyFunSuite { |
23 | 25 | import BinaryUtils.{addDecimalPoint, decodeBinaryNumber} |
@@ -319,5 +321,276 @@ class BinaryDecoderSpec extends AnyFunSuite { |
319 | 321 | bigEndian = false, signed = false) == "11394853559121320169713422235901188200315818") |
320 | 322 | } |
321 | 323 |
|
| 324 | + test("Test EBCDIC not strict integral precision numbers") { |
| 325 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("999", 3, Some(position.Left), isSignSeparate = true, None, None, Some(EBCDIC), None) |
| 326 | + |
| 327 | + val decoderInt = DecoderSelector.getIntegralDecoder(integralType, strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 328 | + val decoderLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 14, isSignSeparate = false), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 329 | + |
| 330 | + val num1 = decoderInt(Array(0xF1, 0xF2, 0xF3).map(_.toByte)) |
| 331 | + assert(num1.isInstanceOf[Integer]) |
| 332 | + assert(num1.asInstanceOf[Integer] == 123) |
| 333 | + |
| 334 | + val num2 = decoderInt(Array(0x60, 0xF2, 0xF3).map(_.toByte)) |
| 335 | + assert(num2.isInstanceOf[Integer]) |
| 336 | + assert(num2.asInstanceOf[Integer] == -23) |
| 337 | + |
| 338 | + val num3 = decoderLong(Array(0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xF0, 0xF1, 0xF2, 0xF3).map(_.toByte)) |
| 339 | + assert(num3.isInstanceOf[Long]) |
| 340 | + assert(num3.asInstanceOf[Long] == 1234567890123L) |
| 341 | + |
| 342 | + val num4 = decoderLong(Array(0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xF0, 0xF1, 0xF2, 0xD3).map(_.toByte)) |
| 343 | + assert(num4.isInstanceOf[Long]) |
| 344 | + assert(num4.asInstanceOf[Long] == -1234567890123L) |
| 345 | + } |
| 346 | + |
| 347 | + test("Test EBCDIC strict integral precision numbers") { |
| 348 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("999", 3, Some(position.Left), isSignSeparate = true, None, None, Some(EBCDIC), None) |
| 349 | + |
| 350 | + val decoderInt = DecoderSelector.getIntegralDecoder(integralType, strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 351 | + val decoderLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 14, isSignSeparate = false), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 352 | + |
| 353 | + val num1 = decoderInt(Array(0xF1, 0xF2, 0xF3).map(_.toByte)) |
| 354 | + assert(num1.isInstanceOf[BigDecimal]) |
| 355 | + assert(num1.asInstanceOf[BigDecimal] == 123) |
| 356 | + |
| 357 | + val num2 = decoderInt(Array(0x60, 0xF2, 0xF3).map(_.toByte)) |
| 358 | + assert(num2.isInstanceOf[BigDecimal]) |
| 359 | + assert(num2.asInstanceOf[BigDecimal] == -23) |
| 360 | + |
| 361 | + val num3 = decoderLong(Array(0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xF0, 0xF1, 0xF2, 0xF3).map(_.toByte)) |
| 362 | + assert(num3.isInstanceOf[BigDecimal]) |
| 363 | + assert(num3.asInstanceOf[BigDecimal] == 1234567890123L) |
| 364 | + |
| 365 | + val num4 = decoderLong(Array(0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xF0, 0xF1, 0xF2, 0xD3).map(_.toByte)) |
| 366 | + assert(num4.isInstanceOf[BigDecimal]) |
| 367 | + assert(num4.asInstanceOf[BigDecimal] == -1234567890123L) |
| 368 | + } |
| 369 | + |
| 370 | + test("Test ASCII not strict integral precision numbers") { |
| 371 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("999", 3, Some(position.Left), isSignSeparate = true, None, None, Some(ASCII), None) |
| 372 | + |
| 373 | + val decoderInt = DecoderSelector.getIntegralDecoder(integralType, strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 374 | + val decoderLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 14, isSignSeparate = false), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 375 | + |
| 376 | + val num1 = decoderInt("123".getBytes) |
| 377 | + assert(num1.isInstanceOf[Integer]) |
| 378 | + assert(num1.asInstanceOf[Integer] == 123) |
| 379 | + |
| 380 | + val num2 = decoderInt("-23".getBytes) |
| 381 | + assert(num2.isInstanceOf[Integer]) |
| 382 | + assert(num2.asInstanceOf[Integer] == -23) |
| 383 | + |
| 384 | + val num3 = decoderLong("1234567890123".getBytes) |
| 385 | + assert(num3.isInstanceOf[Long]) |
| 386 | + assert(num3.asInstanceOf[Long] == 1234567890123L) |
| 387 | + |
| 388 | + val num4 = decoderLong("123456789012L".getBytes) |
| 389 | + assert(num4.isInstanceOf[Long]) |
| 390 | + assert(num4.asInstanceOf[Long] == -1234567890123L) |
| 391 | + } |
| 392 | + |
| 393 | + test("Test ASCII strict integral precision numbers") { |
| 394 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("999", 3, Some(position.Left), isSignSeparate = true, None, None, Some(ASCII), None) |
| 395 | + |
| 396 | + val decoderInt = DecoderSelector.getIntegralDecoder(integralType, strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 397 | + val decoderLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 14, isSignSeparate = false), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 398 | + |
| 399 | + val num1 = decoderInt("123".getBytes) |
| 400 | + assert(num1.isInstanceOf[BigDecimal]) |
| 401 | + assert(num1.asInstanceOf[BigDecimal] == 123) |
| 402 | + |
| 403 | + val num2 = decoderInt("-23".getBytes) |
| 404 | + assert(num2.isInstanceOf[BigDecimal]) |
| 405 | + assert(num2.asInstanceOf[BigDecimal] == -23) |
| 406 | + |
| 407 | + val num3 = decoderLong("1234567890123".getBytes) |
| 408 | + assert(num3.isInstanceOf[BigDecimal]) |
| 409 | + assert(num3.asInstanceOf[BigDecimal] == 1234567890123L) |
| 410 | + |
| 411 | + val num4 = decoderLong("123456789012L".getBytes) |
| 412 | + assert(num4.isInstanceOf[BigDecimal]) |
| 413 | + assert(num4.asInstanceOf[BigDecimal] == -1234567890123L) |
| 414 | + } |
| 415 | + |
| 416 | + test("Test BCD not strict integral precision numbers") { |
| 417 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("S99999", 6, Some(position.Right), isSignSeparate = false, None, Some(COMP3()), Some(EBCDIC), None) |
| 418 | + |
| 419 | + val decoderInt = DecoderSelector.getIntegralDecoder(integralType, strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 420 | + val decoderLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 13, compact = Some(COMP3U())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 421 | + |
| 422 | + val num1 = decoderInt(Array(0x12, 0x34, 0x5C).map(_.toByte)) |
| 423 | + assert(num1.isInstanceOf[Integer]) |
| 424 | + assert(num1.asInstanceOf[Integer] == 12345) |
| 425 | + |
| 426 | + val num2 = decoderInt(Array(0x12, 0x34, 0x5D).map(_.toByte)) |
| 427 | + assert(num2.isInstanceOf[Integer]) |
| 428 | + assert(num2.asInstanceOf[Integer] == -12345) |
| 429 | + |
| 430 | + val num3 = decoderLong(Array(0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x30).map(_.toByte)) |
| 431 | + assert(num3.isInstanceOf[Long]) |
| 432 | + assert(num3.asInstanceOf[Long] == 12345678901230L) |
| 433 | + } |
| 434 | + |
| 435 | + test("Test BCD strict integral precision numbers") { |
| 436 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("S99999", 6, Some(position.Right), isSignSeparate = false, None, Some(COMP3()), Some(EBCDIC), None) |
| 437 | + |
| 438 | + val decoderInt = DecoderSelector.getIntegralDecoder(integralType, strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 439 | + val decoderLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 13, compact = Some(COMP3U())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 440 | + |
| 441 | + val num1 = decoderInt(Array(0x12, 0x34, 0x5C).map(_.toByte)) |
| 442 | + assert(num1.isInstanceOf[BigDecimal]) |
| 443 | + assert(num1.asInstanceOf[BigDecimal] == 12345) |
| 444 | + |
| 445 | + val num2 = decoderInt(Array(0x12, 0x34, 0x5D).map(_.toByte)) |
| 446 | + assert(num2.isInstanceOf[BigDecimal]) |
| 447 | + assert(num2.asInstanceOf[BigDecimal] == -12345) |
| 448 | + |
| 449 | + val num3 = decoderLong(Array(0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x30).map(_.toByte)) |
| 450 | + assert(num3.isInstanceOf[BigDecimal]) |
| 451 | + assert(num3.asInstanceOf[BigDecimal] == 12345678901230L) |
| 452 | + } |
| 453 | + |
| 454 | + test("Test Binary not strict integral precision numbers") { |
| 455 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("999", 3, Some(position.Left), isSignSeparate = true, None, Some(COMP4()), Some(EBCDIC), None) |
| 456 | + |
| 457 | + val decoderSignedByte = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 1, compact = Some(COMP9())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 458 | + val decoderUnsignedByte = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 1, compact = Some(COMP9()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 459 | + val decoderSignedShort = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 3, compact = Some(COMP4())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 460 | + val decoderUnsignedShort = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 3, compact = Some(COMP5()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 461 | + val decoderSignedInt = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 8, compact = Some(COMP4())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 462 | + val decoderUnsignedIntBe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 8, compact = Some(COMP5()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 463 | + val decoderUnsignedIntLe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 8, compact = Some(COMP9()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 464 | + val decoderSignedLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 15, compact = Some(COMP4())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 465 | + val decoderUnsignedLongBe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 15, compact = Some(COMP5()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 466 | + val decoderUnsignedLongLe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 15, compact = Some(COMP9()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = false) |
| 467 | + |
| 468 | + val num1 = decoderSignedByte(Array(0x10).map(_.toByte)) |
| 469 | + assert(num1.isInstanceOf[Integer]) |
| 470 | + assert(num1.asInstanceOf[Integer] == 16) |
| 471 | + |
| 472 | + val num2 = decoderSignedByte(Array(0x90).map(_.toByte)) |
| 473 | + assert(num2.isInstanceOf[Integer]) |
| 474 | + assert(num2.asInstanceOf[Integer] == -112) |
| 475 | + |
| 476 | + val num3 = decoderUnsignedByte(Array(0x90).map(_.toByte)) |
| 477 | + assert(num3.isInstanceOf[Integer]) |
| 478 | + assert(num3.asInstanceOf[Integer] == 144) |
| 479 | + |
| 480 | + val num4 = decoderSignedShort(Array(0x10, 0x01).map(_.toByte)) |
| 481 | + assert(num4.isInstanceOf[Integer]) |
| 482 | + assert(num4.asInstanceOf[Integer] == 4097) |
| 483 | + |
| 484 | + val num5 = decoderSignedShort(Array(0x90, 0x00).map(_.toByte)) |
| 485 | + assert(num5.isInstanceOf[Integer]) |
| 486 | + assert(num5.asInstanceOf[Integer] == -28672) |
| 487 | + |
| 488 | + val num6 = decoderUnsignedShort(Array(0x90, 0x00).map(_.toByte)) |
| 489 | + assert(num6.isInstanceOf[Integer]) |
| 490 | + assert(num6.asInstanceOf[Integer] == 36864) |
| 491 | + |
| 492 | + val num7 = decoderSignedInt(Array(0x01, 0x00, 0x00, 0x00).map(_.toByte)) |
| 493 | + assert(num7.isInstanceOf[Integer]) |
| 494 | + assert(num7.asInstanceOf[Integer] == 16777216) |
| 495 | + |
| 496 | + val num8 = decoderSignedInt(Array(0x90, 0x00, 0x00, 0x00).map(_.toByte)) |
| 497 | + assert(num8.isInstanceOf[Integer]) |
| 498 | + assert(num8.asInstanceOf[Integer] == -1879048192) |
| 499 | + |
| 500 | + val num9 = decoderUnsignedIntBe(Array(0x00, 0x90, 0x00, 0x00).map(_.toByte)) |
| 501 | + assert(num9.isInstanceOf[Integer]) |
| 502 | + assert(num9.asInstanceOf[Integer] == 9437184) |
| 503 | + |
| 504 | + val num10 = decoderUnsignedIntLe(Array(0x00, 0x00, 0x90, 0x00).map(_.toByte)) |
| 505 | + assert(num10.isInstanceOf[Integer]) |
| 506 | + assert(num10.asInstanceOf[Integer] == 9437184) |
| 507 | + |
| 508 | + val num11 = decoderSignedLong(Array(0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00).map(_.toByte)) |
| 509 | + assert(num11.isInstanceOf[Long]) |
| 510 | + assert(num11.asInstanceOf[Long] == 72057594037927936L) |
| 511 | + |
| 512 | + val num12 = decoderSignedLong(Array(0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00).map(_.toByte)) |
| 513 | + assert(num12.isInstanceOf[Long]) |
| 514 | + assert(num12.asInstanceOf[Long] == -8070450532247928832L) |
| 515 | + |
| 516 | + val num13 = decoderUnsignedLongBe(Array(0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00).map(_.toByte)) |
| 517 | + assert(num13.isInstanceOf[Long]) |
| 518 | + assert(num13.asInstanceOf[Long] == 40532396646334464L) |
| 519 | + |
| 520 | + val num14 = decoderUnsignedLongLe(Array(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00).map(_.toByte)) |
| 521 | + assert(num14.isInstanceOf[Long]) |
| 522 | + assert(num14.asInstanceOf[Long] == 40532396646334464L) |
| 523 | + } |
| 524 | + |
| 525 | + test("Test Binary strict integral precision numbers") { |
| 526 | + val integralType = za.co.absa.cobrix.cobol.parser.ast.datatype.Integral("999", 3, Some(position.Left), isSignSeparate = true, None, Some(COMP4()), Some(EBCDIC), None) |
| 527 | + |
| 528 | + val decoderSignedByte = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 1, compact = Some(COMP9())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 529 | + val decoderUnsignedByte = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 1, compact = Some(COMP9()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 530 | + val decoderSignedShort = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 3, compact = Some(COMP4())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 531 | + val decoderUnsignedShort = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 3, compact = Some(COMP5()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 532 | + val decoderSignedInt = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 8, compact = Some(COMP4())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 533 | + val decoderUnsignedIntBe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 8, compact = Some(COMP5()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 534 | + val decoderUnsignedIntLe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 8, compact = Some(COMP9()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 535 | + val decoderSignedLong = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 15, compact = Some(COMP4())), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 536 | + val decoderUnsignedLongBe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 15, compact = Some(COMP5()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 537 | + val decoderUnsignedLongLe = DecoderSelector.getIntegralDecoder(integralType.copy(precision = 15, compact = Some(COMP9()), signPosition = None), strictSignOverpunch = false, improvedNullDetection = false, strictIntegralPrecision = true) |
| 538 | + |
| 539 | + val num1 = decoderSignedByte(Array(0x10).map(_.toByte)) |
| 540 | + assert(num1.isInstanceOf[BigDecimal]) |
| 541 | + assert(num1.asInstanceOf[BigDecimal] == 16) |
| 542 | + |
| 543 | + val num2 = decoderSignedByte(Array(0x90).map(_.toByte)) |
| 544 | + assert(num2.isInstanceOf[BigDecimal]) |
| 545 | + assert(num2.asInstanceOf[BigDecimal] == -112) |
| 546 | + |
| 547 | + val num3 = decoderUnsignedByte(Array(0x90).map(_.toByte)) |
| 548 | + assert(num3.isInstanceOf[BigDecimal]) |
| 549 | + assert(num3.asInstanceOf[BigDecimal] == 144) |
| 550 | + |
| 551 | + val num4 = decoderSignedShort(Array(0x10, 0x01).map(_.toByte)) |
| 552 | + assert(num4.isInstanceOf[BigDecimal]) |
| 553 | + assert(num4.asInstanceOf[BigDecimal] == 4097) |
| 554 | + |
| 555 | + val num5 = decoderSignedShort(Array(0x90, 0x00).map(_.toByte)) |
| 556 | + assert(num5.isInstanceOf[BigDecimal]) |
| 557 | + assert(num5.asInstanceOf[BigDecimal] == -28672) |
| 558 | + |
| 559 | + val num6 = decoderUnsignedShort(Array(0x90, 0x00).map(_.toByte)) |
| 560 | + assert(num6.isInstanceOf[BigDecimal]) |
| 561 | + assert(num6.asInstanceOf[BigDecimal] == 36864) |
| 562 | + |
| 563 | + val num7 = decoderSignedInt(Array(0x01, 0x00, 0x00, 0x00).map(_.toByte)) |
| 564 | + assert(num7.isInstanceOf[BigDecimal]) |
| 565 | + assert(num7.asInstanceOf[BigDecimal] == 16777216) |
| 566 | + |
| 567 | + val num8 = decoderSignedInt(Array(0x90, 0x00, 0x00, 0x00).map(_.toByte)) |
| 568 | + assert(num8.isInstanceOf[BigDecimal]) |
| 569 | + assert(num8.asInstanceOf[BigDecimal] == -1879048192) |
| 570 | + |
| 571 | + val num9 = decoderUnsignedIntBe(Array(0x00, 0x90, 0x00, 0x00).map(_.toByte)) |
| 572 | + assert(num9.isInstanceOf[BigDecimal]) |
| 573 | + assert(num9.asInstanceOf[BigDecimal] == 9437184) |
| 574 | + |
| 575 | + val num10 = decoderUnsignedIntLe(Array(0x00, 0x00, 0x90, 0x00).map(_.toByte)) |
| 576 | + assert(num10.isInstanceOf[BigDecimal]) |
| 577 | + assert(num10.asInstanceOf[BigDecimal] == 9437184) |
| 578 | + |
| 579 | + val num11 = decoderSignedLong(Array(0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00).map(_.toByte)) |
| 580 | + assert(num11.isInstanceOf[BigDecimal]) |
| 581 | + assert(num11.asInstanceOf[BigDecimal] == 72057594037927936L) |
| 582 | + |
| 583 | + val num12 = decoderSignedLong(Array(0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00).map(_.toByte)) |
| 584 | + assert(num12.isInstanceOf[BigDecimal]) |
| 585 | + assert(num12.asInstanceOf[BigDecimal] == -8070450532247928832L) |
| 586 | + |
| 587 | + val num13 = decoderUnsignedLongBe(Array(0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00).map(_.toByte)) |
| 588 | + assert(num13.isInstanceOf[BigDecimal]) |
| 589 | + assert(num13.asInstanceOf[BigDecimal] == 40532396646334464L) |
| 590 | + |
| 591 | + val num14 = decoderUnsignedLongLe(Array(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00).map(_.toByte)) |
| 592 | + assert(num14.isInstanceOf[BigDecimal]) |
| 593 | + assert(num14.asInstanceOf[BigDecimal] == 40532396646334464L) |
| 594 | + } |
322 | 595 |
|
323 | 596 | } |
0 commit comments