@lcap/nasl
Version:
NetEase Application Specific Language
50 lines (48 loc) • 1.31 kB
text/typescript
namespace nasl.core {
import Equal = nasl.test.Equal;
import AssertTrue = nasl.test.AssertTrue;
function testAdd(
l: Long,
d: Decimal,
s: String,
b: Boolean,
dt: DateTime,
t: Time,
date: Date,
any: Any,
dul: Decimal | Long
) {
{
// Long + Long -> Long
const a = add(l, l);
type Case1 = AssertTrue<Equal<typeof a, Long>>;
}
{
// Decimal + Decimal -> Decimal
const a = add(d, d);
type Case2 = AssertTrue<Equal<typeof a, Decimal>>;
}
{
// Decimal | Long + Decimal | Long -> Decimal
const a = add(dul, dul);
type Case3 = AssertTrue<Equal<typeof a, Decimal>>;
// Decimal | Long + Long -> Decimal
const b = add(dul, l);
type Case4 = AssertTrue<Equal<typeof b, Decimal>>;
// Long + Decimal | Long -> Decimal
const c = add(l, dul);
type Case5 = AssertTrue<Equal<typeof c, Decimal>>;
}
{
// String + String -> String
const a = add(s, s);
type Case6 = AssertTrue<Equal<typeof a, String>>;
// String + Any -> String
const b = add(s, any);
type Case7 = AssertTrue<Equal<typeof b, String>>;
// Any + String -> String
const c = add(any, s);
type Case8 = AssertTrue<Equal<typeof c, String>>;
}
}
}