Tweaked truthiness, fixed int to float coersion
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
//booleans
|
||||
{
|
||||
var value = true;
|
||||
|
||||
if (value) {
|
||||
print "correct";
|
||||
}
|
||||
else {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var value = false;
|
||||
|
||||
if (value) {
|
||||
assert false;
|
||||
}
|
||||
else {
|
||||
print "correct";
|
||||
}
|
||||
}
|
||||
|
||||
//integers
|
||||
{
|
||||
var value: int = 42;
|
||||
|
||||
if (value) {
|
||||
print "correct";
|
||||
}
|
||||
else {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var value: int = 0;
|
||||
|
||||
if (value) {
|
||||
assert false;
|
||||
}
|
||||
else {
|
||||
print "correct";
|
||||
}
|
||||
}
|
||||
|
||||
//floats
|
||||
{
|
||||
var value: float = 42.8891;
|
||||
|
||||
if (value) {
|
||||
print "correct";
|
||||
}
|
||||
else {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var value: float = 0;
|
||||
|
||||
if (value) {
|
||||
assert false;
|
||||
}
|
||||
else {
|
||||
print "correct";
|
||||
}
|
||||
}
|
||||
|
||||
//everything else
|
||||
{
|
||||
var value: string = "foobar";
|
||||
|
||||
if (value) {
|
||||
print "correct";
|
||||
}
|
||||
else {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user