Skip to content

Commit 0d2de0f

Browse files
author
Lucas McDonald
committed
Revert "sync"
This reverts commit 0f79ecc.
1 parent c677b73 commit 0d2de0f

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

DynamoDbEncryption/dafny/DynamoDbEncryption/test/DynamoToStruct.dfy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,15 @@ module DynamoToStructTest {
376376
//= type=test
377377
//# Entries in a String Set MUST be ordered in ascending [UTF-16 binary order](./string-ordering.md#utf-16-binary-order).
378378
method {:test} TestSortSSAttr() {
379+
// "\ud800\udc02" <-> "𐀂"
379380
var stringSetValue := AttributeValue.SS(["&","。","\ud800\udc02"]);
380381
// Note that string values are UTF-8 encoded, but sorted by UTF-16 encoding.
381382
var encodedStringSetData := StructuredDataTerminal(value := [
382383
0,0,0,3, // 3 entries in set
383384
0,0,0,1, // 1st entry is 1 byte
384385
0x26, // "&" in UTF-8 encoding
385386
0,0,0,4, // 2nd entry is 4 bytes
386-
0xF0,0x90,0x80,0x82, // "\ud800\udc02" in UTF-8 encoding
387+
0xF0,0x90,0x80,0x82, // "𐀂" in UTF-8 encoding
387388
0,0,0,3, // 3rd entry is 3 bytes
388389
0xEF,0xBD,0xA1 // "。" in UTF-8 encoding
389390
],
@@ -395,6 +396,7 @@ module DynamoToStructTest {
395396

396397
var newStringSetValue := StructuredToAttr(encodedStringSetData);
397398
expect newStringSetValue.Success?;
399+
// "\ud800\udc02" <-> "𐀂"
398400
expect newStringSetValue.value == AttributeValue.SS(["&","\ud800\udc02","。"]);
399401
}
400402

@@ -415,10 +417,12 @@ module DynamoToStructTest {
415417

416418
method {:test} TestSetsInListAreSorted() {
417419
var nSetValue := AttributeValue.NS(["2","1","10"]);
420+
// "\ud800\udc02" <-> "𐀂"
418421
var sSetValue := AttributeValue.SS(["&","。","\ud800\udc02"]);
419422
var bSetValue := AttributeValue.BS([[1,0],[1],[2]]);
420423

421424
var sortedNSetValue := AttributeValue.NS(["1","10","2"]);
425+
// "\ud800\udc02" <-> "𐀂"
422426
var sortedSSetValue := AttributeValue.SS(["&","\ud800\udc02","。"]);
423427
var sortedBSetValue := AttributeValue.BS([[1],[1,0],[2]]);
424428

@@ -444,10 +448,12 @@ module DynamoToStructTest {
444448

445449
method {:test} TestSetsInMapAreSorted() {
446450
var nSetValue := AttributeValue.NS(["2","1","10"]);
451+
// "\ud800\udc02" <-> "𐀂"
447452
var sSetValue := AttributeValue.SS(["&","。","\ud800\udc02"]);
448453
var bSetValue := AttributeValue.BS([[1,0],[1],[2]]);
449454

450455
var sortedNSetValue := AttributeValue.NS(["1","10","2"]);
456+
// "\ud800\udc02" <-> "𐀂"
451457
var sortedSSetValue := AttributeValue.SS(["&","\ud800\udc02","。"]);
452458
var sortedBSetValue := AttributeValue.BS([[1],[1,0],[2]]);
453459

@@ -490,6 +496,7 @@ module DynamoToStructTest {
490496
method {:test} TestSortMapKeys() {
491497
var nullValue := AttributeValue.NULL(true);
492498

499+
// "\ud800\udc02" <-> "𐀂"
493500
var mapValue := AttributeValue.M(map["&" := nullValue, "。" := nullValue, "\ud800\udc02" := nullValue]);
494501

495502
// Note that the string values are encoded as UTF-8, but are sorted according to UTF-16 encoding.
@@ -500,7 +507,7 @@ module DynamoToStructTest {
500507
0x26, // "&" UTF-8 encoded
501508
0,0, 0,0,0,0, // null value
502509
0,1, 0,0,0,4, // 2nd key is a string 4 bytes long
503-
0xF0, 0x90, 0x80, 0x82, // "\ud800\udc02" UTF-8 encoded
510+
0xF0, 0x90, 0x80, 0x82, // "𐀂" UTF-8 encoded
504511
0,0, 0,0,0,0, // null value
505512
0,1, 0,0,0,3, // 3rd key is a string 3 bytes long
506513
0xEF, 0xBD, 0xA1, // "。"

TestVectors/dafny/DDBEncryption/src/WriteManifest.dfy

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,20 @@ module {:options "-functionSyntax:4"} WriteManifest {
218218
const DoNothing : CryptoAction := 3
219219

220220
const A : string := "A"
221-
const B : string := "\ud000" // Ud000"
222-
const C : string := "\ufe4c" // Ufe4c"
223-
const D : string := "\u100001" // U10001
224-
const E : string := "\u100002" // U10002 - same high surrogate as D
225-
const F : string := "\u200002" // U20002 - different high surrogate as D
221+
const B : string := "\ud000" // "Ud000" <-> "퀀"
222+
const C : string := "\ufe4c" // "Ufe4c" <-> "﹌"
223+
const D : string := "\u10001" // "U10001" <-> "𐀁" (surrogate pair: "\uD800\uDC01")
224+
const E : string := "\u10002" // "U10002" <-> "𐀂" (same high surrogate as D: "\uD800\uDC02")
225+
const F : string := "\u20002" // "U20002" <-> "𠀂" (different high surrogate as D: "\D840\uDC02")
226226

227-
// Dafny doesn't handle unicode surrogates correctly.
228-
// lemma CheckLengths()
229-
// ensures |A| == 1
230-
// ensures |B| == 1
231-
// ensures |C| == 1
232-
// ensures |D| == 2
233-
// ensures |E| == 2
234-
// ensures |F| == 2
235-
// {}
227+
lemma CheckLengths()
228+
ensures |A| == 1
229+
ensures |B| == 1
230+
ensures |C| == 1
231+
ensures |D| == 2
232+
ensures |E| == 2
233+
ensures |F| == 2
234+
{}
236235

237236
// Let's make attribute names with complex characters.
238237
// It shouldn't matter, but let's make sure

0 commit comments

Comments
 (0)