Ignore:
Timestamp:
2023-12-27T16:17:21+01:00 (12 months ago)
Author:
taylor.smock
Message:

See #23367: Give some indication when an integer overflow occurs

In this case, we are throwing an ArithmeticException when an overflow occurs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/TileRangeTest.java

    r36140 r36198  
    44
    55import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67
    78import org.junit.jupiter.api.Test;
     
    2122                new TileXY(6, 6), 10).size());
    2223    }
     24
     25    /**
     26     * Ensure that something exceptional happens when an integer overflow happens
     27     */
     28    @Test
     29    void testSizeTooLarge() {
     30        final TileRange allZ16 = new TileRange(new TileXY(0, 0), new TileXY(1 << 16, 1 << 16), 16);
     31        assertThrows(ArithmeticException.class, allZ16::size);
     32    }
    2333}
Note: See TracChangeset for help on using the changeset viewer.