Skip to content
Snippets Groups Projects
Select Git revision
  • 3f5fae36beefdc29de7d1fe814d18f4adc584340
  • master default protected
2 results

Box.java

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ConstantMatrixInitializerTest.java 924 B
    package matrix;
    
    import org.junit.jupiter.api.Test;
    
    import static org.junit.jupiter.api.Assertions.*;
    
    class ConstantMatrixInitializerTest {
        @Test
        public void testMatrixInitializationWithConstantValue() {
            ListMatrix<String> matrix = new ListMatrix<>(3, 3, new ConstantMatrixInitializer<>("X"));
    
            // Test that all cells have the constant value.
            for (int x = 0; x < 3; x++) {
                for (int y = 0; y < 3; y++) {
                    assertEquals("X", matrix.get(x, y));
                }
            }
        }
    
        @Test
        public void testMatrixInitializationWithConstantValue2() {
            ListMatrix<Integer> matrix = new ListMatrix<>(3, 5, new ConstantMatrixInitializer<>(12));
    
            // Test that all cells have the constant value.
            for (int x = 0; x < 3; x++) {
                for (int y = 0; y < 5; y++) {
                    assertEquals(12, matrix.get(x, y));
                }
            }
        }
    }