public void testCopyOf_collection_empty() { Collection<Double> iterable = Collections.emptySet(); assertThat(ImmutableDoubleArray.copyOf(iterable)).isSameAs(ImmutableDoubleArray.of()); }
public void testCopyOf_iterable_collection_empty() { Iterable<Integer> iterable = Collections.emptySet(); assertThat(ImmutableIntArray.copyOf(iterable)).isSameAs(ImmutableIntArray.of()); }
public void testCopyOf_array_empty() { /* * We don't guarantee the same-as property, so we aren't obligated to test it. However, it's * useful in testing - when two things are the same then one can't have bugs the other doesn't. */ assertThat(ImmutableDoubleArray.copyOf(new double[0])).isSameAs(ImmutableDoubleArray.of()); }
public void testCopyOf_array_empty() { /* * We don't guarantee the same-as property, so we aren't obligated to test it. However, it's * useful in testing - when two things are the same then one can't have bugs the other doesn't. */ assertThat(ImmutableLongArray.copyOf(new long[0])).isSameAs(ImmutableLongArray.of()); }
public void testCopyOf_array_empty() { /* * We don't guarantee the same-as property, so we aren't obligated to test it. However, it's * useful in testing - when two things are the same then one can't have bugs the other doesn't. */ assertThat(ImmutableIntArray.copyOf(new int[0])).isSameAs(ImmutableIntArray.of()); }
public void testCopyOf_iterable_notCollection_empty() { Iterable<Long> iterable = iterable(Collections.<Long>emptySet()); assertThat(ImmutableLongArray.copyOf(iterable)).isSameAs(ImmutableLongArray.of()); }
public void testCopyOf_iterable_notCollection_empty() { Iterable<Integer> iterable = iterable(Collections.<Integer>emptySet()); assertThat(ImmutableIntArray.copyOf(iterable)).isSameAs(ImmutableIntArray.of()); }
/** * Asserts that {@code transformation} behaves as expected for {@link * LinearTransformation#forNaN}. */ static void assertLinearTransformationNaN(LinearTransformation transformation) { assertThat(transformation.isHorizontal()).isFalse(); assertThat(transformation.isVertical()).isFalse(); assertThat(transformation.slope()).isNaN(); assertThat(transformation.transform(0.0)).isNaN(); assertThat(transformation.inverse()).isSameAs(transformation); }
public void testCopyOf_stream() { assertThat(ImmutableIntArray.copyOf(IntStream.empty())).isSameAs(ImmutableIntArray.of()); assertThat(ImmutableIntArray.copyOf(IntStream.of(0, 1, 3)).asList()) .containsExactly(0, 1, 3) .inOrder(); }
@Test public void transpose_undirectedNetwork() { MutableNetwork<Integer, String> undirectedGraph = NetworkBuilder.undirected().build(); undirectedGraph.addEdge(N1, N2, E12); assertThat(transpose(undirectedGraph)).isSameAs(undirectedGraph); }
@Test public void transpose_undirectedGraph() { MutableGraph<Integer> undirectedGraph = GraphBuilder.undirected().build(); undirectedGraph.putEdge(N1, N2); assertThat(transpose(undirectedGraph)).isSameAs(undirectedGraph); }
@Test public void copyOfImmutableGraph_optimized() { Graph<String> graph1 = ImmutableGraph.copyOf(GraphBuilder.directed().<String>build()); Graph<String> graph2 = ImmutableGraph.copyOf(graph1); assertThat(graph2).isSameAs(graph1); }
@Test public void copyOfImmutableNetwork_optimized() { Network<String, String> network1 = ImmutableNetwork.copyOf(NetworkBuilder.directed().<String, String>build()); Network<String, String> network2 = ImmutableNetwork.copyOf(network1); assertThat(network2).isSameAs(network1); }
@Test public void copyOfImmutableValueGraph_optimized() { ValueGraph<String, Integer> graph1 = ImmutableValueGraph.copyOf(ValueGraphBuilder.directed().<String, Integer>build()); ValueGraph<String, Integer> graph2 = ImmutableValueGraph.copyOf(graph1); assertThat(graph2).isSameAs(graph1); } }
@Test public void transpose_undirectedValueGraph() { MutableValueGraph<Integer, String> undirectedGraph = ValueGraphBuilder.undirected().build(); undirectedGraph.putEdgeValue(N1, N2, E12); assertThat(transpose(undirectedGraph)).isSameAs(undirectedGraph); }
@GwtIncompatible // SerializableTester public void testSerialization() { assertThat(reserialize(ImmutableLongArray.of())).isSameAs(ImmutableLongArray.of()); assertThat(reserialize(ImmutableLongArray.of(0, 1).subArray(1, 1))) .isSameAs(ImmutableLongArray.of()); ImmutableLongArray iia = ImmutableLongArray.of(0, 1, 3, 6).subArray(1, 3); ImmutableLongArray iia2 = reserialize(iia); assertThat(iia2).isEqualTo(iia); assertDoesntActuallyTrim(iia2); }
@GwtIncompatible // SerializableTester public void testSerialization() { assertThat(reserialize(ImmutableIntArray.of())).isSameAs(ImmutableIntArray.of()); assertThat(reserialize(ImmutableIntArray.of(0, 1).subArray(1, 1))) .isSameAs(ImmutableIntArray.of()); ImmutableIntArray iia = ImmutableIntArray.of(0, 1, 3, 6).subArray(1, 3); ImmutableIntArray iia2 = reserialize(iia); assertThat(iia2).isEqualTo(iia); assertDoesntActuallyTrim(iia2); }
@GwtIncompatible // SerializableTester public void testSerialization() { assertThat(reserialize(ImmutableDoubleArray.of())).isSameAs(ImmutableDoubleArray.of()); assertThat(reserialize(ImmutableDoubleArray.of(0, 1).subArray(1, 1))) .isSameAs(ImmutableDoubleArray.of()); ImmutableDoubleArray iia = ImmutableDoubleArray.of(0, 1, 3, 6).subArray(1, 3); ImmutableDoubleArray iia2 = reserialize(iia); assertThat(iia2).isEqualTo(iia); assertDoesntActuallyTrim(iia2); }
public void testCopyOf_stream() { assertThat(ImmutableLongArray.copyOf(LongStream.empty())).isSameAs(ImmutableLongArray.of()); assertThat(ImmutableLongArray.copyOf(LongStream.of(0, 1, 3)).asList()) .containsExactly(0L, 1L, 3L) .inOrder(); }
public void testCopyOf_stream() { assertThat(ImmutableDoubleArray.copyOf(DoubleStream.empty())) .isSameAs(ImmutableDoubleArray.of()); assertThat(ImmutableDoubleArray.copyOf(DoubleStream.of(0, 1, 3)).asList()) .containsExactly(0.0, 1.0, 3.0) .inOrder(); }