feat: 提交0.4加速版二维码直传与自动配网优化
This commit is contained in:
@@ -7,6 +7,16 @@ import java.nio.ByteOrder
|
||||
import java.util.zip.CRC32
|
||||
|
||||
class ProtocolTest {
|
||||
@Test
|
||||
fun parsesPcToPhoneAutomaticDownloadPairing() {
|
||||
val json = """{"v":2,"s":"abcdefghijklmnopqrstuvwxyz012345","n":"DESKTOP-QFT","p":39393,"e":["http://192.168.49.1:39393"],"d":"d","f":"sample.bin","z":42,"h":"${"00".repeat(32)}"}"""
|
||||
val text = "QFTSEND2:" + Base64Url.encode(json.toByteArray())
|
||||
val payload = PairingProtocol.parse(text)!!
|
||||
assertEquals(TransferDirection.DOWNLOAD_TO_PHONE, payload.direction)
|
||||
assertEquals("sample.bin", payload.fileName)
|
||||
assertEquals(42L, payload.fileSize)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun base45KnownVectors() {
|
||||
assertArrayEquals("AB".toByteArray(), Base45.decode("BB8"))
|
||||
|
||||
Reference in New Issue
Block a user