コード例 #1
0
  @Test
  public void testCanonicalProductIso() {
    DOT dot1 = fixtures.dotBar();
    DOT dot2 = fixtures.dotFoo();
    ProductDiagram<DOT, ARROW> productA = _topos.product(dot1, dot2);
    ProductDiagram<DOT, ARROW> productB = _topos.product(dot1, dot2);

    ARROW isoAB = _topos.canonicalIso(productA, productB);
    ARROW isoBA = _topos.canonicalIso(productB, productA);

    DOT dotA = productA.getProduct();
    DOT dotB = productB.getProduct();

    assertSame(isoAB.getSource(), dotA);
    assertSame(isoAB.getTarget(), dotB);
    assertSame(isoBA.getSource(), dotB);
    assertSame(isoBA.getTarget(), dotA);

    assertEquals(dotA.getIdentity(), isoBA.compose(isoAB));
    assertEquals(dotB.getIdentity(), isoAB.compose(isoBA));
  }
コード例 #2
0
  @Test
  public void testCanonicalExponentialIso() {
    DOT dot1 = fixtures.dotFoo();
    DOT dot2 = fixtures.dotBar();

    ExponentialDiagram<DOT, ARROW> expA = _topos.getExponentialDiagram(dot1, dot2);
    ExponentialDiagram<DOT, ARROW> expB = _topos.getExponentialDiagram(dot1, dot2);

    ARROW isoAB = _topos.canonicalIso(expA, expB);
    ARROW isoBA = _topos.canonicalIso(expB, expA);

    DOT dotA = exponentialDot(expA);
    DOT dotB = exponentialDot(expB);

    assertSame(isoAB.getSource(), dotA);
    assertSame(isoAB.getTarget(), dotB);
    assertSame(isoBA.getSource(), dotB);
    assertSame(isoBA.getTarget(), dotA);

    assertEquals(dotA.getIdentity(), isoBA.compose(isoAB));
    assertEquals(dotB.getIdentity(), isoAB.compose(isoBA));
  }