#version 2.0 import { exception ConstraintErrorException; } function jo_konverziok() { u32 u; u = tou32(123); u = tou32(123u); u = tou32(123l); u = tou32(123ul); u = tou32(123.f); u = tou32(123.0); i32 i; i = toi32(123); i = toi32(123u); i = toi32(123l); i = toi32(123ul); i = toi32(123.f); i = toi32(123.0); i64 l; l = toi64(123); l = toi64(123u); l = toi64(123l); l = toi64(123ul); l = toi64(123.f); l = toi64(123.0); u64 ul; ul = tou64(123); ul = tou64(123u); ul = tou64(123l); ul = tou64(123ul); ul = tou64(123.f); ul = tou64(123.0); exception(ConstraintErrorException) { write("Hibas konverzio: ha ez itt elofordul, akkor nagy baj van.\n"); } finally { write("Jo konverziok tesztelese veget ert.\n"); } } function rossz_0() { u32 u = tou32(-1); write("\tVan konverzio [FAIL]\n"); exception(ConstraintErrorException) { write("\tNincs konverzio [OK]\n"); } } function rossz_1() { i32 i = toi32(0x98765432u); write("\tVan konverzio [FAIL]\n"); exception(ConstraintErrorException) { write("\tNincs konverzio [OK]\n"); } } function rossz_2() { u64 u = tou64(-1); write("\tVan konverzio [FAIL]\n"); exception(ConstraintErrorException) { write("\tNincs konverzio [OK]\n"); } } function rossz_3() { i64 i = toi64(0x9876543200000000ul); write("\tVan konverzio [FAIL]\n"); exception(ConstraintErrorException) { write("\tNincs konverzio [OK]\n"); } } function rossz() { write("Hibas konverziok:\n"); rossz_0(); rossz_1(); rossz_2(); rossz_3(); } main { jo_konverziok(); rossz(); }