- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for safeAdd (0.67 sec)
-
src/test/java/jcifs/util/ServerResponseValidatorTest.java
public void testSafeAdd() throws Exception { assertEquals(10, validator.safeAdd(5, 5)); assertEquals(0, validator.safeAdd(-5, 5)); assertEquals(-10, validator.safeAdd(-5, -5)); } @Test public void testSafeAddOverflow() throws Exception { assertThrows(SmbException.class, () -> { validator.safeAdd(Integer.MAX_VALUE, 1); }); } @Test
Registered: Sun Sep 07 00:10:21 UTC 2025 - Last Modified: Sat Aug 30 05:58:03 UTC 2025 - 14.2K bytes - Viewed (0) -
src/test/java/jcifs/util/InputValidatorTest.java
void testSafeAddition() { assertEquals(100, InputValidator.safeAdd(50, 50)); assertEquals(0, InputValidator.safeAdd(-50, 50)); assertThrows(ArithmeticException.class, () -> InputValidator.safeAdd(Integer.MAX_VALUE, 1)); assertThrows(ArithmeticException.class, () -> InputValidator.safeAdd(Integer.MIN_VALUE, -1)); } @Test
Registered: Sun Sep 07 00:10:21 UTC 2025 - Last Modified: Sat Aug 30 05:58:03 UTC 2025 - 11.9K bytes - Viewed (0) -
src/main/java/jcifs/util/InputValidator.java
* * @param a first operand * @param b second operand * @return sum of a and b * @throws ArithmeticException if overflow occurs */ public static int safeAdd(int a, int b) { validateIntegerAddition(a, b, "Addition"); return a + b; } /** * Safe integer multiplication with overflow check * * @param a first operand
Registered: Sun Sep 07 00:10:21 UTC 2025 - Last Modified: Sat Aug 30 05:58:03 UTC 2025 - 13.5K bytes - Viewed (0) -
src/main/java/jcifs/util/ServerResponseValidator.java
* Safely add integers checking for overflow * * @param a first value * @param b second value * @return sum * @throws SmbException if overflow would occur */ public int safeAdd(int a, int b) throws SmbException { totalValidations.incrementAndGet(); long result = (long) a + (long) b; if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) {
Registered: Sun Sep 07 00:10:21 UTC 2025 - Last Modified: Sat Aug 30 05:58:03 UTC 2025 - 16.6K bytes - Viewed (0)