当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tman.suite函数代码示例

本文整理汇总了TypeScript中tman.suite函数的典型用法代码示例。如果您正苦于以下问题:TypeScript suite函数的具体用法?TypeScript suite怎么用?TypeScript suite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了suite函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: suite

suite('ACK Frame', function () {
  suite('parsing', function () {
    it('a sample ACK frame', function () {
      const buf = bufferFromBytes([0x40,
        0x1c,     // largest acked
        0x0, 0x0, // delay time
        0x1c, // block length
        0,
      ])
      const ackFrame = AckFrame.fromBuffer(new BufferVisitor(buf))
      ok(ackFrame.largestAcked === 0x1c)
      ok(ackFrame.lowestAcked === 0x1)
      ok(ackFrame.delayTime === 0)
      ok(ackFrame.hasMissingRanges() === false)

      // ignore Timestamps
      ok(toBuffer(ackFrame).equals(bufferFromBytes([0x40, 0x1c, 0x0, 0x0, 0x1c, 0x0])))
    })

    it('parse with parseFrame', function () {
      const buf = bufferFromBytes([0x40,
        0x1c,     // largest acked
        0x0, 0x0, // delay time
        0x1c, // block length
        0,
      ])
      const ackFrame = parseFrame(new BufferVisitor(buf), new PacketNumber(1)) as AckFrame
      ok(ackFrame.largestAcked === 0x1c)
      ok(ackFrame.lowestAcked === 0x1)
      ok(ackFrame.delayTime === 0)
      ok(ackFrame.hasMissingRanges() === false)

      // ignore Timestamps
      ok(toBuffer(ackFrame).equals(bufferFromBytes([0x40, 0x1c, 0x0, 0x0, 0x1c, 0x0])))
    })

    it('a frame without a timestamp', function () {
      const buf = bufferFromBytes([0x40, 0x3, 0x15, 0x50, 0x3, 0x0])
      const ackFrame = AckFrame.fromBuffer(new BufferVisitor(buf)) as AckFrame
      ok(ackFrame.largestAcked === 0x3)
      ok(ackFrame.lowestAcked === 0x1)
      ok(ackFrame.delayTime === 6816)
      ok(ackFrame.hasMissingRanges() === false)
    })

    it('a frame with a 48 bit packet number', function () {
      const buf = bufferFromBytes([0x4c, 0x37, 0x13, 0xad, 0xfb, 0xca, 0xde, 0x0, 0x0, 0x5, 0x1, 0, 0, 0, 0, 0])
      const ackFrame = AckFrame.fromBuffer(new BufferVisitor(buf))
      ok(ackFrame.largestAcked === 0x3713adfbcade)
      ok(ackFrame.lowestAcked === 0x3713adfbcade - 5 + 1)
      ok(ackFrame.hasMissingRanges() === false)
    })

    it('a frame with 1 ACKed packet', function () {
      const buf = bufferFromBytes([0x40, 0x10, 0x8e, 0x0, 0x1, 0x0])
      const ackFrame = AckFrame.fromBuffer(new BufferVisitor(buf))
      ok(ackFrame.largestAcked === 0x10)
      ok(ackFrame.lowestAcked === 0x10)
      ok(ackFrame.hasMissingRanges() === false)
    })

    it('a frame, when packet 1 was lost', function () {
      const buf = bufferFromBytes([0x40, 0x9, 0x92, 0x7, 0x8, 0x3, 0x2, 0x69, 0xa3, 0x0, 0x0, 0x1,
        0xc9, 0x2, 0x0, 0x46, 0x10])
      const ackFrame = AckFrame.fromBuffer(new BufferVisitor(buf))
      ok(ackFrame.largestAcked === 9)
      ok(ackFrame.lowestAcked === 2)
      ok(ackFrame.hasMissingRanges() === false)
    })

    it('a frame with multiple timestamps', function () {
      const buf = bufferFromBytes([0x40, 0x10, 0x0, 0x0, 0x10, 0x4, 0x1, 0x6b, 0x26, 0x4, 0x0, 0x3,
        0, 0, 0x2, 0, 0, 0x1, 0, 0])
      const ackFrame = AckFrame.fromBuffer(new BufferVisitor(buf))
      ok(ackFrame.largestAcked === 0x10)
      ok(ackFrame.lowestAcked === 1)
      ok(ackFrame.hasMissingRanges() === false)
    })

    it('errors when the ACK range is too large', function () {
      // LargestAcked: 0x1c
      // Length: 0x1d => LowestAcked would be -1
      throws(() => {
        const buf = bufferFromBytes([0x40, 0x1c, 0x8e, 0x0, 0x1d, 0x1, 0x1, 0x6b, 0x26, 0x3, 0x0])
        AckFrame.fromBuffer(new BufferVisitor(buf))
      })
    })

    it('errors when the first ACK range is empty', function () {
      throws(() => {
        const buf = bufferFromBytes([0x40, 0x9, 0x8e, 0x0, 0x0, 0x1, 0])
        AckFrame.fromBuffer(new BufferVisitor(buf))
      })
    })
  })

  suite('ACK blocks', function () {
    it('a frame with one ACK block', function () {
      const buf = bufferFromBytes([0x60, 0x18, 0x94, 0x1, 0x1, 0x3, 0x2, 0x10, 0x2, 0x1, 0x5c, 0xd5,
        0x0, 0x0, 0x0, 0x95, 0x0])
//.........这里部分代码省略.........
开发者ID:toajs,项目名称:quic,代码行数:101,代码来源:ack.ts

示例2: suite

suite('STOP_WAITING Frame', function () {
  it('new StopWaitingFrame', function () {
    const headerPacketNumber = PacketNumber.fromBuffer(new BufferVisitor(bufferFromBytes([0xff, 0x1f])), 2)
    const leastUnacked = PacketNumber.fromBuffer(new BufferVisitor(bufferFromBytes([0xff, 0x0f])), 2).valueOf()
    const stopWaitingFrame = new StopWaitingFrame(headerPacketNumber, leastUnacked)

    strictEqual(stopWaitingFrame.type, 6)
    strictEqual(leastUnacked, stopWaitingFrame.leastUnacked)
    const buf = toBuffer(stopWaitingFrame)
    ok(buf.equals(bufferFromBytes([
      0x06,
      0x00, 0x10,
    ])))
    ok(buf.equals(toBuffer(StopWaitingFrame.fromBuffer(new BufferVisitor(buf), headerPacketNumber))))
  })

  it('parse with parseFrame', function () {
    const headerPacketNumber = PacketNumber.fromBuffer(new BufferVisitor(bufferFromBytes([0xff, 0x1f])), 2)
    const leastUnacked = PacketNumber.fromBuffer(new BufferVisitor(bufferFromBytes([0xff, 0x0f])), 2).valueOf()
    const stopWaitingFrame = new StopWaitingFrame(headerPacketNumber, leastUnacked)

    strictEqual(stopWaitingFrame.type, 6)
    strictEqual(leastUnacked, stopWaitingFrame.leastUnacked)
    const buf = toBuffer(stopWaitingFrame)
    ok(buf.equals(bufferFromBytes([
      0x06,
      0x00, 0x10,
    ])))
    ok(buf.equals(toBuffer(parseFrame(new BufferVisitor(buf), headerPacketNumber))))
  })
})
开发者ID:toajs,项目名称:quic,代码行数:31,代码来源:stop_waiting.ts

示例3: suite

  WindowUpdateFrame, BlockedFrame, StopWaitingFrame,
  PingFrame, CongestionFeedbackFrame,
} from '../../src/internal/frame'

import { bufferFromBytes } from '../common'

suite('CONGESTION_FEEDBACK Frame', function () {
  it('new CongestionFeedbackFrame', function () {
    const congestionFeedbackFrame = new CongestionFeedbackFrame()

    strictEqual(congestionFeedbackFrame.type, 32)
    const buf = toBuffer(congestionFeedbackFrame)
    ok(buf.equals(bufferFromBytes([0b00100000])))
    ok(buf.equals(toBuffer(CongestionFeedbackFrame.fromBuffer(new BufferVisitor(buf)))))
  })

  it('parse with parseFrame', function () {
    const congestionFeedbackFrame = new CongestionFeedbackFrame()

    strictEqual(congestionFeedbackFrame.type, 32)
    const buf = toBuffer(congestionFeedbackFrame)
    ok(buf.equals(bufferFromBytes([0b00100000])))
    ok(buf.equals(toBuffer(parseFrame(new BufferVisitor(buf), new PacketNumber(1)))))
  })

  it('when invalid CongestionFeedbackFrame type', function () {
    throws(() => CongestionFeedbackFrame.fromBuffer(new BufferVisitor(bufferFromBytes([0b01100000]))),
      /INVALID_FRAME_DATA/)
  })
})
开发者ID:toajs,项目名称:quic,代码行数:30,代码来源:congestion_feedback.ts

示例4: suite

'use strict'
// **Github:** https://github.com/fidm/quic
//
// **License:** MIT

import { suite, it } from 'tman'
import { ok, strictEqual } from 'assert'
import { bufferFromBytes } from './common'
import { fnv1a64Hash } from '../src/internal/crypto'

suite('crypto', function () {
  it('fnv1a64Hash', function () {
    ok(bufferFromBytes([0xcb, 0xf2, 0x9c, 0xe4, 0x84, 0x22, 0x23, 0x25])
      .equals(fnv1a64Hash(Buffer.from(''), false)))
    ok(bufferFromBytes([0xaf, 0x63, 0xdc, 0x4c, 0x86, 0x01, 0xec, 0x8c])
      .equals(fnv1a64Hash(Buffer.from('a'), false)))
    ok(bufferFromBytes([0x08, 0x9c, 0x44, 0x07, 0xb5, 0x45, 0x98, 0x6a])
      .equals(fnv1a64Hash(Buffer.from('ab'), false)))
    ok(bufferFromBytes([0xe7, 0x1f, 0xa2, 0x19, 0x05, 0x41, 0x57, 0x4b])
      .equals(fnv1a64Hash(Buffer.from('abc'), false)))

    ok(bufferFromBytes([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0])
      .equals(fnv1a64Hash(bufferFromBytes([0x07, 0x1e, 0x62, 0x37, 0x2c, 0x02, 0x40, 0x42, 0x14, 0x69]), false)))
    ok(bufferFromBytes([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0])
      .equals(fnv1a64Hash(bufferFromBytes([0x30, 0x5e, 0x64, 0x66, 0x59, 0x24, 0x65, 0x64, 0x5f, 0x06]), false)))
    ok(bufferFromBytes([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0])
      .equals(fnv1a64Hash(bufferFromBytes([0x7b, 0x3e, 0x68, 0x34, 0x5f, 0x71, 0x43, 0x2a, 0x13, 0x12]), false)))
  })
})
开发者ID:toajs,项目名称:quic,代码行数:29,代码来源:crypto.ts

示例5: suite

suite('QUIC errors', function () {
  it('new QuicError(0)', function () {
    const err = new QuicError(0)
    strictEqual(err.code, 0)
    strictEqual(err.name, 'QUIC_NO_ERROR')
    strictEqual(err.message, '')
    ok(err.stack.includes(join('test', 'error.ts')))
    ok(toBuffer(err).equals(bufferFromBytes([0x0, 0x0, 0x0, 0x0])))
    deepEqual(err, new QuicError('QUIC_NO_ERROR'))
  })

  it('new QuicError(1)', function () {
    const err = new QuicError(1)
    strictEqual(err.code, 1)
    strictEqual(err.name, 'QUIC_INTERNAL_ERROR')
    strictEqual(err.message, 'Connection has reached an invalid state.')
    ok(err.stack.includes(join('test', 'error.ts')))
    ok(toBuffer(err).equals(bufferFromBytes([0x0, 0x0, 0x0, 0x1])))
    deepEqual(err, new QuicError('QUIC_INTERNAL_ERROR'))
  })

  it('new QuicError(UNKNOWN_ERROR)', function () {
    const err = new QuicError('xxxxxxxx')
    strictEqual(err.code, 0xffffffff)
    strictEqual(err.name, 'INVALID_ERROR_CODE')
    strictEqual(err.message, 'xxxxxxxx')
    ok(err.stack.includes(join('test', 'error.ts')))
    ok(toBuffer(err).equals(bufferFromBytes([0xff, 0xff, 0xff, 0xff])))
  })

  it('QuicError.fromBuffer', function () {
    strictEqual(QuicError.fromBuffer(new BufferVisitor(bufferFromBytes([0x0, 0x0, 0x0, 0x0]))).name, 'QUIC_NO_ERROR')
    let err = QuicError.fromBuffer(new BufferVisitor(bufferFromBytes([0x0, 0x0, 0x0, 0x1])))
    deepEqual(err, new QuicError(1))

    err = QuicError.fromBuffer(new BufferVisitor(bufferFromBytes([0x1, 0x1, 0x1, 0x1])))
    strictEqual(err.code, 0xffffffff)
    strictEqual(err.name, 'INVALID_ERROR_CODE')
    strictEqual(err.message, String(0x01010101))
  })
})
开发者ID:toajs,项目名称:quic,代码行数:41,代码来源:error.ts

示例6: suite

suite('WINDOW_UPDATE Frame', function () {
  it('new WindowUpdateFrame with StreamID', function () {
    const streamID = new StreamID(10)
    const offset = Offset.fromBuffer(new BufferVisitor(bufferFromBytes([0xff, 0xff, 0xff, 0xff])), 4)
    const windowUpdateFrame = new WindowUpdateFrame(streamID, offset)

    strictEqual(windowUpdateFrame.type, 4)
    const buf = toBuffer(windowUpdateFrame)
    ok(buf.equals(bufferFromBytes([
      0x04,
      0x00, 0x00, 0x00, 0x0a,
      0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
    ])))
    ok(buf.equals(toBuffer(WindowUpdateFrame.fromBuffer(new BufferVisitor(buf)))))
  })

  it('parse with parseFrame', function () {
    const streamID = new StreamID(10)
    const offset = Offset.fromBuffer(new BufferVisitor(bufferFromBytes([0xff, 0xff, 0xff, 0xff])), 4)
    const windowUpdateFrame = new WindowUpdateFrame(streamID, offset)

    strictEqual(windowUpdateFrame.type, 4)
    const buf = toBuffer(windowUpdateFrame)
    ok(buf.equals(bufferFromBytes([
      0x04,
      0x00, 0x00, 0x00, 0x0a,
      0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
    ])))
    ok(buf.equals(toBuffer(parseFrame(new BufferVisitor(buf), new PacketNumber(1)))))
  })
})
开发者ID:toajs,项目名称:quic,代码行数:31,代码来源:window_update.ts

示例7: suite

suite('QUIC Packet', function () {
  suite('ResetPacket', function () {
    it('fromBuffer and toBuffer', function () {
      const connectionID = ConnectionID.random()
      const quicTag = new QuicTags(Tag.PRST)
      quicTag.set(Tag.RNON, bufferFromBytes([
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB,
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB,
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB,
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB]))
      quicTag.set(Tag.RSEQ, toBuffer(new PacketNumber(1)))
      quicTag.set(Tag.CADR, bufferFromBytes([
        0x00, 0x02,
        0x04, 0x1F, 0xC6, 0x2C,
        0x01, 0xBB]))

      const resetPacket = new ResetPacket(connectionID, quicTag)
      const buf = toBuffer(resetPacket)
      const res = ResetPacket.fromBuffer(new BufferVisitor(buf))
      ok(res instanceof ResetPacket)
      ok(resetPacket.flag === res.flag)
      ok(resetPacket.connectionID.equals(res.connectionID))
      ok(resetPacket.packetNumber.equals(res.packetNumber))
      ok(resetPacket.nonceProof.equals(res.nonceProof))
      ok(resetPacket.socketAddress.equals(res.socketAddress))
    })

    it('parse with parsePacket', function () {
      const connectionID = ConnectionID.random()
      const quicTag = new QuicTags(Tag.PRST)
      quicTag.set(Tag.RNON, bufferFromBytes([
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB,
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB,
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB,
        0x89, 0x67, 0x45, 0x23,
        0x01, 0xEF, 0xCD, 0xAB]))
      quicTag.set(Tag.RSEQ, toBuffer(new PacketNumber(1)))
      quicTag.set(Tag.CADR, bufferFromBytes([
        0x00, 0x02,
        0x04, 0x1F, 0xC6, 0x2C,
        0x01, 0xBB]))

      const resetPacket = new ResetPacket(connectionID, quicTag)
      const buf = toBuffer(resetPacket)
      const res = parsePacket(new BufferVisitor(buf), SessionType.SERVER) as ResetPacket
      ok(res instanceof ResetPacket)
      ok(resetPacket.flag === res.flag)
      ok(resetPacket.connectionID.equals(res.connectionID))
      ok(resetPacket.packetNumber.equals(res.packetNumber))
      ok(resetPacket.nonceProof.equals(res.nonceProof))
      ok(resetPacket.socketAddress.equals(res.socketAddress))
    })
  })

  suite('NegotiationPacket', function () {
    it('fromBuffer and toBuffer', function () {
      const connectionID = ConnectionID.random()
      const negotiationPacket = NegotiationPacket.fromConnectionID(connectionID)
      deepEqual(negotiationPacket.versions, getVersions())
      ok(isSupportedVersion(negotiationPacket.versions[0]))

      const buf = toBuffer(negotiationPacket)
      const res = NegotiationPacket.fromBuffer(new BufferVisitor(buf))
      ok(res instanceof NegotiationPacket)
      ok(negotiationPacket.flag === res.flag)
      ok(negotiationPacket.connectionID.equals(res.connectionID))
      deepEqual(negotiationPacket.versions, res.versions)
    })

    it('parse with parsePacket', function () {
      const connectionID = ConnectionID.random()
      const negotiationPacket = NegotiationPacket.fromConnectionID(connectionID)
      deepEqual(negotiationPacket.versions, getVersions())
      ok(isSupportedVersion(negotiationPacket.versions[0]))

      const buf = toBuffer(negotiationPacket)
      const res = parsePacket(new BufferVisitor(buf), SessionType.SERVER) as NegotiationPacket
      ok(res instanceof NegotiationPacket)
      ok(negotiationPacket.flag === res.flag)
      ok(negotiationPacket.connectionID.equals(res.connectionID))
      deepEqual(negotiationPacket.versions, res.versions)
    })
  })

  suite('RegularPacket', function () {
    it('fromBuffer and toBuffer', function () {
      const connectionID = ConnectionID.random()
      const packetNumber = new PacketNumber(16)
      const regularPacket = new RegularPacket(connectionID, packetNumber)
      regularPacket.setVersion(getVersion())
      regularPacket.addFrames(new PaddingFrame(), new PingFrame())
      const buf = toBuffer(regularPacket)
      const bufv = new BufferVisitor(buf)
//.........这里部分代码省略.........
开发者ID:toajs,项目名称:quic,代码行数:101,代码来源:packet.ts

示例8: suite

import { bufferFromBytes } from '../common'

suite('BLOCKED Frame', function () {
  it('new BlockedFrame with StreamID', function () {
    const streamID = new StreamID(10)
    const blockedFrame = new BlockedFrame(streamID)

    strictEqual(blockedFrame.type, 5)
    const buf = toBuffer(blockedFrame)
    ok(buf.equals(bufferFromBytes([
      0x05,
      0x00, 0x00, 0x00, 0x0a,
    ])))
    ok(buf.equals(toBuffer(BlockedFrame.fromBuffer(new BufferVisitor(buf)))))
  })

  it('parse with parseFrame', function () {
    const streamID = new StreamID(10)
    const blockedFrame = new BlockedFrame(streamID)

    strictEqual(blockedFrame.type, 5)
    const buf = toBuffer(blockedFrame)
    ok(buf.equals(bufferFromBytes([
      0x05,
      0x00, 0x00, 0x00, 0x0a,
    ])))
    ok(buf.equals(toBuffer(parseFrame(new BufferVisitor(buf), new PacketNumber(1)))))
  })
})
开发者ID:toajs,项目名称:quic,代码行数:29,代码来源:blocked.ts

示例9: suite

suite('STREAM Frame', function () {
  it('new StreamFrame', function () {
    let streamID = new StreamID(1)
    let offset = new Offset(0)
    let data = bufferFromBytes(['abcdefg'])
    let streamFrame = new StreamFrame(streamID, offset).setData(data)

    strictEqual(streamFrame.isFIN, false)
    let buf = toBuffer(streamFrame)
    ok(buf.equals(bufferFromBytes([
      0b10100000,
      0x1,
      0x0, 0x7,
      'abcdefg',
    ])))
    ok(buf.equals(toBuffer(StreamFrame.fromBuffer(new BufferVisitor(buf)))))

    streamID = streamID.nextID()
    offset = new Offset(offset.valueOf() + data.length)
    data = bufferFromBytes(['higklmn'])
    streamFrame = new StreamFrame(streamID, offset, false).setData(data)

    strictEqual(streamFrame.isFIN, false)
    buf = toBuffer(streamFrame)
    ok(buf.equals(bufferFromBytes([
      0b10100100,
      0x3,
      0x0, 0x7,
      0x0, 0x7,
      'higklmn',
    ])))
    ok(buf.equals(toBuffer(StreamFrame.fromBuffer(new BufferVisitor(buf)))))

    streamID = streamID.nextID()
    offset = new Offset(offset.valueOf() + data.length)
    data = bufferFromBytes(['opqrst'])
    streamFrame = new StreamFrame(streamID, offset, false).setData(data)

    strictEqual(streamFrame.isFIN, false)
    buf = toBuffer(streamFrame)
    ok(buf.equals(bufferFromBytes([
      0b10100100,
      0x5,
      0x0, 0xe,
      0x0, 0x6,
      'opqrst',
    ])))
    ok(buf.equals(toBuffer(StreamFrame.fromBuffer(new BufferVisitor(buf)))))

    streamID = streamID.nextID()
    offset = new Offset(offset.valueOf() + data.length)
    data = bufferFromBytes(['uvwxyz'])
    streamFrame = new StreamFrame(streamID, offset, true).setData(data)

    strictEqual(streamFrame.isFIN, true)
    buf = toBuffer(streamFrame)
    ok(buf.equals(bufferFromBytes([
      0b11100100,
      0x7,
      0x0, 0x14,
      0x0, 0x6,
      'uvwxyz',
    ])))
    ok(buf.equals(toBuffer(StreamFrame.fromBuffer(new BufferVisitor(buf)))))
  })

  it('parse with parseFrame', function () {
    const streamID = new StreamID(1)
    const offset = new Offset(0)
    const data = bufferFromBytes(['abcd'])
    const streamFrame = new StreamFrame(streamID, offset, false).setData(data)
    const buf = toBuffer(streamFrame)

    ok(buf.equals(toBuffer(parseFrame(new BufferVisitor(buf), new PacketNumber(1)))))
  })

  it('when invalid StreamFrame type', function () {
    const streamID = new StreamID(1)
    const offset = new Offset(0)
    const data = bufferFromBytes(['abcd'])
    const streamFrame = new StreamFrame(streamID, offset, false).setData(data)
    const buf = toBuffer(streamFrame)

    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 1))), /INVALID_STREAM_DATA/)
    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 2))), /INVALID_STREAM_DATA/)
    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 3))), /INVALID_STREAM_DATA/)
    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 4))), /INVALID_STREAM_DATA/)
    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 5))), /INVALID_STREAM_DATA/)
    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 6))), /INVALID_STREAM_DATA/)
    throws(() => StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, 7))), /INVALID_STREAM_DATA/)
    ok(buf.equals(toBuffer(StreamFrame.fromBuffer(new BufferVisitor(buf.slice(0, streamFrame.byteLen()))))))
  })
})
开发者ID:toajs,项目名称:quic,代码行数:93,代码来源:stream.ts


注:本文中的tman.suite函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。