Files
Nim/tests/range/tcompiletime_range_checks.nim
Andreas Rumpf 1109fc4f83 migrate the main test suite from Azure Pipelines to GitHub Actions (#26168)
The Microsoft-hosted Azure agents are 2-core; the GitHub-hosted runners
are 4-core (3-core on macOS arm64). Measured on an identical `koch boot
-d:release` against our own Docs CI, the GitHub runners are ~2.3x
faster:

  Linux boot     8.2 min -> 4.5 min
  Windows boot  11.4 min -> 4.9 min
  macOS boot     4.2 min -> 1.7 min
  csources       2.0 min -> 0.8 min

`.github/workflows/ci_main.yml` keeps the same six jobs, the same runner
images, the same dependency installation and the same `ci/funs.sh` entry
points, so this is a move, not a redesign.

Differences forced by the platform:

* `[skip ci]` is handled natively by GitHub, so the `nimIsCiSkip` step
and the `skipci` variable that gated every step are gone. `nimIsCiSkip`
stays in `ci/funs.sh` for the version branches.
* `SYSTEM_ACCESSTOKEN` is gone: `testament/azure.nim` activates on
`TF_BUILD`, which is unset here, so it no-ops. This also removes a flake
source, where a failure to create the Azure test run cancelled an
otherwise green job.
* `concurrency: cancel-in-progress` replaces Azure's `pr.autoCancel`.
* `NIM_TESTAMENT_BATCH` defaults to `_` explicitly: a matrix-derived env
var is set to the empty string rather than left unset, so `getEnv`'s
default would not have applied.

`disabled: "azure"` was the only way to skip a test on the main
pipeline, so add `disabled: "github"` (`isGithubActions`) to replace it;
`azure` is kept as deprecated, alongside `travis` and `appveyor`.

Two manual steps remain: disabling the Azure pipeline definition, and
pointing the required status checks at the new job names.

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2026-09-09 06:53:02 +02:00

54 lines
2.6 KiB
Nim

discard """
cmd: "nim check --hint:Processing:off --hint:Conf:off $file"
errormsg: "18446744073709551615 can't be converted to int8"
nimout: '''
tcompiletime_range_checks.nim(37, 21) Error: 2147483648 can't be converted to int32
tcompiletime_range_checks.nim(39, 34) Error: 255 can't be converted to FullNegativeRange
tcompiletime_range_checks.nim(40, 34) Error: 18446744073709551615 can't be converted to HalfNegativeRange
tcompiletime_range_checks.nim(41, 34) Error: 300 can't be converted to FullPositiveRange
tcompiletime_range_checks.nim(42, 30) Error: 101 can't be converted to UnsignedRange
tcompiletime_range_checks.nim(43, 32) Error: -9223372036854775808 can't be converted to SemiOutOfBounds
tcompiletime_range_checks.nim(45, 22) Error: nan can't be converted to int32
tcompiletime_range_checks.nim(46, 22) Error: 1e+100 can't be converted to int64
tcompiletime_range_checks.nim(47, 23) Error: 1e+100 can't be converted to uint64
tcompiletime_range_checks.nim(50, 22) Error: 18446744073709551615 can't be converted to int64
tcompiletime_range_checks.nim(51, 22) Error: 18446744073709551615 can't be converted to int32
tcompiletime_range_checks.nim(52, 22) Error: 18446744073709551615 can't be converted to int16
tcompiletime_range_checks.nim(53, 21) Error: 18446744073709551615 can't be converted to int8
'''
"""
type
UnsignedRange* = range[0'u64 .. 100'u64]
SemiOutOfBounds* = range[0x7ffffffffffffe00'u64 .. 0x8000000000000100'u64]
FullOutOfBounds* = range[0x8000000000000000'u64 .. 0x8000000000000200'u64]
FullNegativeRange* = range[-200 .. -100]
HalfNegativeRange* = range[-50 .. 50]
FullPositiveRange* = range[100 .. 200]
let acceptA* = int32(0x7fffffff'i64)
let acceptB* = (uint64(0'i64))
let acceptD* = (HalfNegativeRange(25'u64))
let acceptE* = (UnsignedRange(50'u64))
let acceptF* = (SemiOutOfBounds(0x7ffffffffffffe00'i64))
let acceptH* = (SemiOutOfBounds(0x8000000000000000'u64))
let rejectA* = int32(0x80000000'i64)
let rejectB* = (uint64(-1'i64))
let rejectC* = (FullNegativeRange(0xff'u32))
let rejectD* = (HalfNegativeRange(0xffffffffffffffff'u64)) # internal `intVal` is `-1` which would be in range.
let rejectE* = (FullPositiveRange(300'u64))
let rejectF* = (UnsignedRange(101'u64))
let rejectG* = (SemiOutOfBounds(0x8000000000000000'i64)) #
let rejectH* = (int32(NaN))
let rejectI* = (int64(1e100))
let rejectJ* = (uint64(1e100))
# removed cross checks from tarithm.nim
let rejectK* = (int64(0xFFFFFFFFFFFFFFFF'u64))
let rejectL* = (int32(0xFFFFFFFFFFFFFFFF'u64))
let rejectM* = (int16(0xFFFFFFFFFFFFFFFF'u64))
let rejectN* = (int8(0xFFFFFFFFFFFFFFFF'u64))