forked from GaijinEntertainment/daScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,43 @@ | ||
require math | ||
options log=true, logStack=true, logNodes=true | ||
|
||
options logCpp=true | ||
[unsafe,sideeffects] | ||
def test_good_array | ||
let arr <- toarray([[int 1;2;3;4]]) | ||
let ait : iterator<int&> = _builtin_make_iterator(arr,typeinfo(sizeof type int)) | ||
var ikey : int? | ||
var pkey : void? = reinterpret<void?>(addr(ikey)) | ||
var loop = _builtin_iterator_first(ait,pkey) | ||
while loop | ||
print("*ait = {deref(ikey)}\n") | ||
loop = _builtin_iterator_next(ait,pkey) | ||
_builtin_iterator_close(ait,pkey) | ||
|
||
[sideeffects] | ||
def cf(a) | ||
return ceili(a) | ||
[unsafe,sideeffects] | ||
def test_keys_values | ||
let t <- totable([[auto 1=>"one"; 2=>"two"; 3=>"three"]]) | ||
for k,v in keys(t),values(t) | ||
print("{k} => {v}\n") | ||
if true | ||
let itk : iterator<int const&> = keys(t) | ||
var ikey : int? | ||
var pkey : void? = reinterpret<void?>(addr(ikey)) | ||
var loop = _builtin_iterator_first(itk,pkey) | ||
while loop | ||
print("*ikey = {deref(ikey)}\n") | ||
loop = _builtin_iterator_next(itk,pkey) | ||
_builtin_iterator_close(itk,pkey) | ||
if true | ||
let itv : iterator<string&> = values(t) | ||
var sval : string? | ||
var pval : void? = reinterpret<void?>(addr(sval)) | ||
var loop = _builtin_iterator_first(itv,pval) | ||
while loop | ||
print("itv = {deref(sval)}\n") | ||
loop = _builtin_iterator_next(itv,pval) | ||
_builtin_iterator_close(itv,pval) | ||
|
||
[export] | ||
def test | ||
print("ceili(1.2)={cf(1.2)}") | ||
test_good_array() | ||
test_keys_values() | ||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters