Reviewed By: jvillard Differential Revision: D21226982 fbshipit-source-id: 4b63b19b8master
parent
6790417e82
commit
9f81b7c880
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class InferAnnotationTest {
|
||||
|
||||
public void assert_not_null_linear(Integer x) {
|
||||
for (int i = 0; i < Assertions.assertNotNull(x); i++) {}
|
||||
}
|
||||
|
||||
public void assert_not_null_explanation_linear(Integer x) {
|
||||
for (int i = 0; i < Assertions.assertNotNull(x, "explanation"); i++) {}
|
||||
}
|
||||
|
||||
public void assume_not_null_linear(Integer x) {
|
||||
for (int i = 0; i < Assertions.assumeNotNull(x); i++) {}
|
||||
}
|
||||
|
||||
public void assume_not_null_explanation_linear(Integer x) {
|
||||
for (int i = 0; i < Assertions.assumeNotNull(x, "explanation"); i++) {}
|
||||
}
|
||||
|
||||
public void nullsafe_fixme_linear(Integer x) {
|
||||
for (int i = 0; i < Assertions.nullsafeFIXME(x, "explanation"); i++) {}
|
||||
}
|
||||
|
||||
public void assert_get_list_constant() {
|
||||
ArrayList<Integer> a = new ArrayList<>();
|
||||
a.add(5);
|
||||
for (int i = 0; i < Assertions.assertGet(0, a); i++) {}
|
||||
}
|
||||
|
||||
public void assert_get_map_constant() {
|
||||
HashMap<Integer, Integer> m = new HashMap<Integer, Integer>();
|
||||
m.put(0, 5);
|
||||
for (int i = 0; i < Assertions.assertGet(0, m); i++) {}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue