]> git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/length.qc
renaming the length operator to _length and fixing the lexing of that operator, gener...
[xonotic/gmqcc.git] / tests / length.qc
1 const string a = "hello world"; // 11
2 float b[] = { 1, 2, 3 };        // 3
3 float c[5] = { 5, 4, 3, 2, 1 }; // 5
4 const float d[] = { 1 };        // 1
5
6 void main() {
7     print(ftos(_length a), "\n"); // 11
8     print(ftos(_length b), "\n"); // 3
9     print(ftos(_length c), "\n"); // 5
10     print(ftos(_length d), "\n"); // 1
11
12     static float al = _length(a);
13     static float bl = _length(b);
14     static float cl = _length(c);
15     static float dl = _length(d);
16
17     print(ftos(al), "\n"); // 11
18     print(ftos(bl), "\n"); // 3
19     print(ftos(cl), "\n"); // 5
20     print(ftos(dl), "\n"); // 1
21
22     print(ftos(_length "hello world"), "\n"); // 11
23 }