[ 
https://issues.apache.org/jira/browse/DAFFODIL-2293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17066132#comment-17066132
 ] 

Baumann Kurt edited comment on DAFFODIL-2293 at 3/24/20, 7:44 PM:
------------------------------------------------------------------

Hi Steve, Hi Mike,

I have adjusted the 3Bit-Version of the class and executed the tests in the new 
class TestNonByteSizedCharsetDecoders8Bit.scala.
{code:java}
  @Test def test3BitMSBF_01(): Unit = {
    val cs = CharsetUtils.getCharset("X-DFDL-ISO-88591-8-BIT-PACKED-MSB-FIRST")
    val decoder = cs.newDecoder()
    val cb = CharBuffer.allocate(64)
    val bb = ByteBuffer.wrap(Misc.bits2Bytes("00000000 00000001 00000010 
00000011 00000100 00000101 00000110 00000111"))
    val dis = InputSourceDataInputStream(bb)
    val res = decoder.decode(dis, msbfFinfo, cb)
    assertEquals(8, res)
    cb.flip()
    val digits = cb.toString()
    assertEquals("01234567", digits)
  }
{code}
The result of the test execution is not (as expected) successfully. Following 
information is logged:
{code:java}
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetDecoders8Bit.test3BitMSBF_01 
started
[error] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetDecoders8Bit.test3BitMSBF_01 
failed: expected:<[01234567]> but was:<[ ]>, took 0.038 sec
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetDecoders8Bit.test3BitMSBF_01 
finished, took 0.039 sec
[debug] Test run finished: 1 failed, 0 ignored, 1 total, 0.081s
{code}
Why I don't get the number "01234567" as result? Can you spot the problem?

Thanks again!! Best regards, Kurt

 

Remark: 
- I do have a similar issue when executing the basic encoder test.
{code}
  @Test def test3BitMSBF_01(): Unit = {
    val cs = CharsetUtils.getCharset("X-DFDL-ISO-88591-8-BIT-PACKED-MSB-FIRST")
    val encoder = cs.newEncoder()
    val cb = CharBuffer.wrap("01234567")
    val expectedBytes = Misc.bits2Bytes("00000000 00000001 00000010 00000011 
00000100 00000101 00000110 00000111").toList
    val bb = ByteBuffer.allocate(8)
    val res = encoder.encode(cb, bb, false)
    assertTrue(res.isUnderflow())
    bb.flip()
    val actualBytes = bb.array().toList
    assertEquals(expectedBytes, actualBytes)
  }
{code}

- The test output is as following:
{code}
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetEncoders8Bit.test3BitMSBF_01 
started
[error] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetEncoders8Bit.test3BitMSBF_01 
failed: expected:<List(0, 1, 2, 3, 4, 5, 6, 7)> but was:<List(48, 49, 50, 51, 
52, 53, 54, 55)>, took 0.003 sec
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetEncoders8Bit.test3BitMSBF_01 
finished, took 0.003 sec
{code}


was (Author: kuba72):
Hi Steve, Hi Mike,

I have adjusted the 3Bit-Version of the class and executed the tests in the new 
class TestNonByteSizedCharsetDecoders8Bit.scala.
{code:java}
  @Test def test3BitMSBF_01(): Unit = {
    val cs = CharsetUtils.getCharset("X-DFDL-ISO-88591-8-BIT-PACKED-MSB-FIRST")
    val decoder = cs.newDecoder()
    val cb = CharBuffer.allocate(64)
    val bb = ByteBuffer.wrap(Misc.bits2Bytes("00000000 00000001 00000010 
00000011 00000100 00000101 00000110 00000111"))
    val dis = InputSourceDataInputStream(bb)
    val res = decoder.decode(dis, msbfFinfo, cb)
    assertEquals(8, res)
    cb.flip()
    val digits = cb.toString()
    assertEquals("01234567", digits)
  }
{code}
The result of the test execution is not (as expected) successfully. Following 
information is logged:
{code:java}
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetDecoders8Bit.test3BitMSBF_01 
started
[error] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetDecoders8Bit.test3BitMSBF_01 
failed: expected:<[01234567]> but was:<[ ]>, took 0.038 sec
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetDecoders8Bit.test3BitMSBF_01 
finished, took 0.039 sec
[debug] Test run finished: 1 failed, 0 ignored, 1 total, 0.081s
{code}
Why I don't get the number "01234567" as result? Can you spot the problem?

Thanks again!! Best regards, Kurt

 

Remark: 
- I do have a similar issue when executing the basic encoder test.
{code}
  @Test def test3BitMSBF_01(): Unit = {
    val cs = CharsetUtils.getCharset("X-DFDL-ISO-88591-8-BIT-PACKED-MSB-FIRST")
    val encoder = cs.newEncoder()
    val cb = CharBuffer.wrap("01234567")
    val expectedBytes = Misc.bits2Bytes("00000000 00000001 00000010 00000011 
00000100 00000101 00000110 00000111").toList
    val bb = ByteBuffer.allocate(8)
    val res = encoder.encode(cb, bb, false)
    assertTrue(res.isUnderflow())
    bb.flip()
    val actualBytes = bb.array().toList
    assertEquals(expectedBytes, actualBytes)
  }
{code}

The test output is as following:
{code}
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetEncoders8Bit.test3BitMSBF_01 
started
[error] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetEncoders8Bit.test3BitMSBF_01 
failed: expected:<List(0, 1, 2, 3, 4, 5, 6, 7)> but was:<List(48, 49, 50, 51, 
52, 53, 54, 55)>, took 0.003 sec
[debug] Test 
org.apache.daffodil.io.TestNonByteSizedCharsetEncoders8Bit.test3BitMSBF_01 
finished, took 0.003 sec
{code}

> Too many bits in xs:string
> --------------------------
>
>                 Key: DAFFODIL-2293
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2293
>             Project: Daffodil
>          Issue Type: Question
>            Reporter: Alexander Deutschmann
>            Priority: Major
>
> Hello everyone,
> i have the following schema:
> {code:xml}
> <xs:complexType name="statusReportDetails">
>               <xs:sequence>
>                       <xs:element name="state" type="abc:stateenum" 
> dfdl:length="4" />
>                       <xs:element name="indicators" type="abc:indicators"  
> dfdl:length="16" />
>                       <xs:element name="v" type="v" dfdl:length="10" />
>                       <xs:element name="driverId" type="xs:string" 
> dfdl:lengthKind="explicit" dfdl:length="128" dfdl:alignment="8" />
>               </xs:sequence>
>       </xs:complexType>
> {code}
> And the related bitstream:
> {code:java}
> 0101 -> Enum
> 0000110000000001 -> indicators
> 0001100100 -> v
> 0000110001001100010011000100110001001100100011001000110010001100100011001100110011001100110011001100110100001101000011010000110100
>  -> driverId
> {code}
> The driverId has 130 bits and not the 128. bits which is defined in the 
> schema. 
> My question is where comes the first two bits ? I know it is an configuration 
> mistake or something like that.
> I hope someone can help me.
> Thank you.
> Alex



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to