@@ -157,6 +157,46 @@ module TestBaseBeacon {
157
157
}
158
158
159
159
160
+ method {:test} TestCompoundQueries () {
161
+ var context := ExprContext (
162
+ None,
163
+ Some("Mixed = :mixed "),
164
+ None,
165
+ None
166
+ );
167
+ var version := GetLotsaBeacons ();
168
+ var src := GetLiteralSource ([1,2,3,4,5], version);
169
+ var beaconVersion :- expect C. ConvertVersionWithSource (FullTableConfig, version, src);
170
+
171
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("N_MyName.Y_1984")]));
172
+ var newContext :- expect Beaconize (beaconVersion, context, DontUseKeyId);
173
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("N_MyName")]));
174
+ newContext :- expect Beaconize (beaconVersion, context, DontUseKeyId);
175
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("Y_1984")]));
176
+ newContext :- expect Beaconize (beaconVersion, context, DontUseKeyId);
177
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("T_foo")]));
178
+ newContext :- expect Beaconize (beaconVersion, context, DontUseKeyId);
179
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("M_bar")]));
180
+ newContext :- expect Beaconize (beaconVersion, context, DontUseKeyId);
181
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("T_foo.M_bar")]));
182
+ newContext :- expect Beaconize (beaconVersion, context, DontUseKeyId);
183
+
184
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("N_MyName.N_MyName")]));
185
+ var badContext := Beaconize (beaconVersion, context, DontUseKeyId);
186
+ expect badContext. Failure?;
187
+ expect badContext. error == E ("Compound Beacon value 'N_MyName.N_MyName' cannot be constructed from any available constructor for Mixed value parsed as N_N_ available constructors are N_Y_, T_[M_].");
188
+
189
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("Y_1984.N_MyName")]));
190
+ badContext := Beaconize (beaconVersion, context, DontUseKeyId);
191
+ expect badContext. Failure?;
192
+ expect badContext. error == E ("Compound Beacon value 'Y_1984.N_MyName' cannot be constructed from any available constructor for Mixed value parsed as Y_N_ available constructors are N_Y_, T_[M_].");
193
+
194
+ context := context. (values := Some (map[":mixed " := DDB.AttributeValue.S("M_bar.T_foo")]));
195
+ badContext := Beaconize (beaconVersion, context, DontUseKeyId);
196
+ expect badContext. Failure?;
197
+ expect badContext. error == E ("Compound Beacon value 'M_bar.T_foo' cannot be constructed from any available constructor for Mixed value parsed as M_T_ available constructors are N_Y_, T_[M_].");
198
+ }
199
+
160
200
method {:test} TestQueryBeacons () {
161
201
var context := ExprContext (
162
202
None,
@@ -173,7 +213,7 @@ module TestBaseBeacon {
173
213
":NameTitle" := DDB. AttributeValue. S ("N_MyName.T_MyTitle"),
174
214
":NameTitleN" := DDB. AttributeValue. S ("N_MyName"),
175
215
":NameTitleT" := DDB. AttributeValue. S ("T_MyTitle"),
176
- ":NameTitleTN" := DDB. AttributeValue. S ("T_MyTitle. N_MyName"),
216
+ ":NameTitleTN" := DDB. AttributeValue. S ("N_MyName.T_MyTitle "),
177
217
":NameTitleField" := DDB. AttributeValue. S ("MyName__mytitle"),
178
218
":YearName" := DDB. AttributeValue. S ("Y_1984.N_MyName")
179
219
]),
@@ -187,7 +227,7 @@ module TestBaseBeacon {
187
227
":Mixed " := DDB.AttributeValue.S("N_" + Name_beacon + ".Y_1984"),
188
228
":Name" := DDB. AttributeValue. S (Name_beacon),
189
229
":NameTitle" := DDB. AttributeValue. S ("N_" + Name_beacon + ".T_" + Title_beacon),
190
- ":NameTitleTN" := DDB. AttributeValue. S ("T_ " + Title_beacon + ".N_ " + Name_beacon ),
230
+ ":NameTitleTN" := DDB. AttributeValue. S ("N_ " + Name_beacon + ".T_ " + Title_beacon ),
191
231
":NameTitleN" := DDB. AttributeValue. S ("N_" + Name_beacon),
192
232
":NameTitleT" := DDB. AttributeValue. S ("T_" + Title_beacon),
193
233
":NameTitleField" := DDB. AttributeValue. S (NameTitle_beacon),
0 commit comments