This website requires JavaScript.
Cadquos
Explore
Marketplace
Help
Register
Sign In
Cadquos
Development
Main Navigation
🏠
Dashboard
🏢
Organizations
8
📁
Repositories
8
👥
Team
🗓️
Calendar
Workspace
📝
작업메모
🚀
시작하기
📝
빠른 메모
👻
나의 공간
3
📝
작업목록
Settings
Connections
Public Pages
Notifications
3
Help Center
John Smith
john@example.com
ByoungSooPark
/
modeling-app
Watch
1
Star
0
Fork
0
You've already forked modeling-app
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
Files
ff6186f4f027eca4cd380c76aa571a5c40e7713f
modeling-app
/
rust
/
kcl-lib
/
tests
/
array_range_negative_expr
/
input.kcl
3 lines
73 B
Plaintext
Raw
Normal View
History
Unescape
Escape
Move tests from no_visuals into simulation tests (#4367) Now you can properly inspect program memory for the no_visuals tests, instead of relying on a lot of KCL asserts.
2024-11-04 20:34:22 -06:00
xs = [int(-5) .. 5]
Implement dynamic ranges (#4151) Closes #4021 Allows array ranges (e.g., `[0..10]`) to take expression instead of just numeric literals as their start and end values. Both expressions are required (we don't support `[0..]`, etc.). I've created a new kind of expression in the AST. The alternative was to represent the internals of an array as some kind of pattern which could initially be fully explicit or ranges. I figured the chosen version was simpler and easier to extend to open ranges, whereas the latter would be easier to extend to mixed ranges or other patterns. I chose simpler, it'll be easy enough to refactor if necessary. Parsing is tested implicitly by the tests of execution and unparsing. --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
2024-10-17 02:58:04 +13:00
assertEqual(xs[0], -5, 0.001, "first element is -5")
Reference in New Issue
Copy Permalink