/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/javascript/overload_bool_runme.js
60 строк
1 KB
Momtchil Momtchev
add more JS run tests
30 май 2023, 21:12
30 май 2023, 21:12
bcfeed0
Код
Авторство
О чём код?
var overload_bool = require("overload_bool"); // Overloading bool, int, string if (overload_bool.overloaded(true) != "bool") { throw new Error("wrong!"); } if (overload_bool.overloaded(false) != "bool") { throw new Error("wrong!"); } if (overload_bool.overloaded(0) != "int") { throw new Error("wrong!"); } if (overload_bool.overloaded(1) != "int") { throw new Error("wrong!"); } if (overload_bool.overloaded(2) != "int") { throw new Error("wrong!"); } if (overload_bool.overloaded("1234") != "string") { throw new Error("wrong!"); } // Test bool masquerading as int // Not possible // Test int masquerading as bool // Not possible /////////////////////////////////////////////// // Overloading bool, int, string if (overload_bool.overloaded_ref(true) != "bool") { throw new Error("wrong!"); } if (overload_bool.overloaded_ref(false) != "bool") { throw new Error("wrong!"); } if (overload_bool.overloaded_ref(0) != "int") { throw new Error("wrong!"); } if (overload_bool.overloaded_ref(1) != "int") { throw new Error("wrong!"); } if (overload_bool.overloaded_ref(2) != "int") { throw new Error("wrong!"); } if (overload_bool.overloaded_ref("1234") != "string") { throw new Error("wrong!"); } // Test bool masquerading as int // Not possible // Test int masquerading as bool // Not possible