17
17
import java .io .IOException ;
18
18
import java .util .Arrays ;
19
19
import java .util .Collection ;
20
+ import java .util .Collections ;
20
21
import java .util .HashMap ;
21
22
import java .util .HashSet ;
22
23
import java .util .Iterator ;
@@ -105,8 +106,11 @@ public void testTf2()
105
106
testTf2 ("tf2p2.py" , "value_index" , 2 , 4 , 2 , 3 );
106
107
testTf2 ("tf2q.py" , "add" , 2 , 3 , 2 , 3 );
107
108
testTf2 ("tf2r.py" , "add" , 2 , 3 , 2 , 3 );
108
- // TODO: Uncomment below test when https://github.com/wala/ML/issues/65 is fixed.
109
- // testTf2("tf2s.py", "add", 2, 3, 2, 3);
109
+ testTf2 (
110
+ "tf2s.py" , "add" , 0 ,
111
+ 0 ); // NOTE: Set the expected number of tensor parameters, variables, and tensor parameter
112
+ // value numbers to 2, 3, and 2 and 3, respectively, when
113
+ // https://github.com/wala/ML/issues/65 is fixed.
110
114
testTf2 ("tf2t.py" , "add" , 2 , 3 , 2 , 3 );
111
115
testTf2 ("tf2u.py" , "add" , 2 , 3 , 2 , 3 );
112
116
testTf2 ("tf2u2.py" , "add" , 2 , 3 , 2 , 3 );
@@ -245,7 +249,8 @@ private void testTf2(
245
249
final String functionSignature = "script " + filename + "." + functionName + ".do()LRoot;" ;
246
250
247
251
// get the pointer keys for the function.
248
- Set <LocalPointerKey > functionPointerKeys = methodSignatureToPointerKeys .get (functionSignature );
252
+ Set <LocalPointerKey > functionPointerKeys =
253
+ methodSignatureToPointerKeys .getOrDefault (functionSignature , Collections .emptySet ());
249
254
250
255
// check tensor parameters.
251
256
assertEquals (expectedNumberOfTensorParameters , functionPointerKeys .size ());
@@ -261,7 +266,8 @@ private void testTf2(
261
266
.forEach (ev -> actualValueNumberSet .contains (ev ));
262
267
263
268
// get the tensor variables for the function.
264
- Set <TensorVariable > functionTensors = methodSignatureToTensorVariables .get (functionSignature );
269
+ Set <TensorVariable > functionTensors =
270
+ methodSignatureToTensorVariables .getOrDefault (functionSignature , Collections .emptySet ());
265
271
266
272
// check tensor parameters.
267
273
assertEquals (expectedNumberOfTensorParameters , functionTensors .size ());
0 commit comments