Skip to content

Commit

Permalink
🧪 test: Add add_LI_L
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Oct 28, 2024
1 parent 4ec0537 commit 73a668e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/ts/test/test.basic.operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class Test {
return a + b;
}

public add_LI_L(a: long, b: int): long {
return a + b;
}

public divide_II_I(a: int, b: int): int {
return a / b;
}
Expand Down Expand Up @@ -36,6 +40,7 @@ class Test {

console.log(new Test().add_II_I(1, 2));
console.log(new Test().add_IL_L(1, 2));
console.log(new Test().add_LI_L(1, 2));
console.log(new Test().divide_II_I(3, 2));
console.log(new Test().mod_II_I(3, 2));
console.log(new Test().multiply_II_I(3, 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ public void testAdd_IL_L() throws Exception {
assertEquals(1 + 2L, method.invoke(object, 1, 2L));
}

@Test
public void testAdd_LI_L() throws Exception {
Method method = clazz.getMethod("add_LI_L", long.class, int.class);
assertNotNull(method);
assertEquals(long.class, method.getReturnType());
assertEquals(2, method.getParameterCount());
assertEquals(long.class, method.getParameters()[0].getType());
assertEquals(int.class, method.getParameters()[1].getType());
Object object = clazz.getConstructor().newInstance();
assertEquals(1L + 2, method.invoke(object, 1L, 2));
}

@Test
public void testDivide_II_I() throws Exception {
Method method = clazz.getMethod("divide_II_I", int.class, int.class);
Expand Down

0 comments on commit 73a668e

Please sign in to comment.