use of com.google.firestore.v1beta1.Value in project firebase-android-sdk by firebase.
the class UserDataWriterTest method testConvertsBlobValue.
@Test
public void testConvertsBlobValue() {
List<Blob> testCases = asList(blob(1, 2, 3), blob(1, 2));
for (Blob b : testCases) {
Value value = wrap(b);
Object convertedValue = convertValue(value);
assertEquals(b, convertedValue);
}
}
use of com.google.firestore.v1beta1.Value in project firebase-android-sdk by firebase.
the class UserDataWriterTest method testConvertsLists.
@Test
public void testConvertsLists() {
ArrayValue.Builder expectedArray = ArrayValue.newBuilder().addValues(wrap("value")).addValues(wrap(true));
Value actual = wrap(asList("value", true));
assertTrue(Values.equals(Value.newBuilder().setArrayValue(expectedArray).build(), actual));
}
use of com.google.firestore.v1beta1.Value in project firebase-android-sdk by firebase.
the class UserDataWriterTest method testConvertsDoubleValue.
@SuppressWarnings("UnnecessaryBoxing")
@Test
public void testConvertsDoubleValue() {
List<Double> testCases = asList(Double.POSITIVE_INFINITY, -Double.MAX_VALUE, Double.valueOf(-Float.MAX_VALUE), Long.MIN_VALUE * 1.0, -1.1, Double.valueOf(-Float.MIN_VALUE), -Double.MIN_VALUE, -0.0, 0.0, Double.valueOf(Float.MIN_VALUE), Double.MIN_VALUE, Double.valueOf(Float.MIN_NORMAL), Double.MIN_NORMAL, Long.MAX_VALUE * 1.0, Double.valueOf(Float.MAX_VALUE), Double.MAX_VALUE, Double.POSITIVE_INFINITY, Double.NaN);
for (Double d : testCases) {
Value value = wrap(d);
assertValueType(Value.ValueTypeCase.DOUBLE_VALUE, value);
Object convertedValue = convertValue(value);
assertEquals(d, convertedValue);
}
}
use of com.google.firestore.v1beta1.Value in project firebase-android-sdk by firebase.
the class UserDataWriterTest method testConvertsLongValue.
@SuppressWarnings("UnnecessaryBoxing")
@Test
public void testConvertsLongValue() {
List<Long> testCases = asList(Long.MIN_VALUE, Long.valueOf(Integer.MIN_VALUE), -1L, 0L, 1L, Long.valueOf(Integer.MAX_VALUE), Long.MAX_VALUE);
for (Long l : testCases) {
Value value = wrap(l);
assertValueType(Value.ValueTypeCase.INTEGER_VALUE, value);
Object convertedValue = convertValue(value);
assertEquals(l, convertedValue);
}
}
use of com.google.firestore.v1beta1.Value in project firebase-android-sdk by firebase.
the class UserDataWriterTest method testConvertsIntegerValue.
@Test
public void testConvertsIntegerValue() {
List<Integer> testCases = asList(Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE);
for (Integer i : testCases) {
Value value = wrap(i);
assertValueType(Value.ValueTypeCase.INTEGER_VALUE, value);
Object convertedValue = convertValue(value);
assertEquals(i.longValue(), convertedValue);
}
}
Aggregations