Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions core/src/test/java/fj/data/DListTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package fj.data;

import org.junit.Test;

import static fj.data.DList.*;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class DListTest {
@Test
public void testConsSnoc() {
assertThat(nil().snoc(2).cons(1).toJavaList(), is(single(1).snoc(2).toJavaList()));
}

@Test
public void testListDList() {
DList<Integer> d = listDList(List.range(0, 1000));
assertThat(d.toJavaList(), is(List.range(0, 1000).toJavaList()));
}

@Test
public void testArrayDList() {
DList<Integer> d = arrayDList(Array.range(0, 1000).array(Integer[].class));
assertThat(d.toJavaList(), is(Array.range(0, 1000).toJavaList()));
}
@Test
public void testIter() {
DList<Integer> d = iteratorDList(List.range(0, 1000).iterator());
assertThat(d.toJavaList(), is(List.range(0, 1000).toJavaList()));
}
}