MCPcopy Create free account
hub / github.com/covscript/covscript / range

Function range

sources/covscript.cpp:341–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339// Internal Functions
340
341 var range(vector &args)
342 {
343 switch (args.size()) {
344 case 1:
345 cs_impl::check_args<numeric>(args);
346 return var::make_constant<range_type>(0, args[0].const_val<numeric>(), 1);
347 case 2:
348 cs_impl::check_args<numeric, numeric>(args);
349 return var::make_constant<range_type>(args[0].const_val<numeric>(), args[1].const_val<numeric>(), 1);
350 case 3:
351 cs_impl::check_args<numeric, numeric, numeric>(args);
352 return var::make_constant<range_type>(args[0].const_val<numeric>(), args[1].const_val<numeric>(),
353 args[2].const_val<numeric>());
354 default:
355 throw cs::runtime_error(
356 "Wrong size of the arguments. Expected 1, 2 or 3, provided " + std::to_string(args.size()));
357 }
358 }
359
360 numeric to_integer(const var &val)
361 {

Callers 10

test_sequential_execFunction · 0.85
test_sequential_fcallFunction · 0.85
test_recursionFunction · 0.85
test_math_opsFunction · 0.85
rand_bytesFunction · 0.85
test_string_opsFunction · 0.85
test_array_indexFunction · 0.85
test_hash_indexFunction · 0.85
test_quicksortFunction · 0.85

Calls 3

runtime_errorClass · 0.85
sizeMethod · 0.80
to_stringFunction · 0.70

Tested by 9

test_sequential_execFunction · 0.68
test_sequential_fcallFunction · 0.68
test_recursionFunction · 0.68
test_math_opsFunction · 0.68
test_string_opsFunction · 0.68
test_array_indexFunction · 0.68
test_hash_indexFunction · 0.68
test_quicksortFunction · 0.68