File: isundef-test.scad

package info (click to toggle)
openscad 2021.01-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,096 kB
  • sloc: cpp: 53,199; sh: 4,384; ansic: 4,382; python: 1,813; yacc: 853; javascript: 762; lex: 417; lisp: 163; xml: 127; makefile: 118
file content (52 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
echo("Normal variables");
echo(is_undef(a)); //no warning
b="hallo";
echo(is_undef(b));
c=undef;
echo(is_undef(c));

echo(a); //warns
echo(b);
echo(c);

echo("Test with scopes");
if(true){
    echo(is_undef(b));
    
    d=true;
    echo(is_undef(c));
    echo(d);
}
echo(is_undef(d));
echo(d);

echo("Special variables");
echo(is_undef($a)); //no warning
$b=132465;
echo(is_undef($b));
$c=undef;
echo(is_undef($c));

echo($a);
echo($b);
echo($c);

echo("constants resulting in true");
echo(is_undef(undef));

echo("constants resulting in false");
echo(is_undef("Test"));
echo(is_undef(123456));

echo("constants resulting in undef");
echo(is_undef());
echo(is_undef("Test",123));
echo(is_undef(123,456));

echo("functions resulting in true");
echo(is_undef(len("test","upps")));
echo(is_undef(is_undef()));

echo("functions resulting in false");
echo(is_undef(sin(1)));
echo(is_undef(len("test")));