mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
Updates Benchmark macro parsing to use Generic Argument (#13919)
* WIP Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Removes POC code * Adds assertion and UT * adds runtime error * removes const_assert * ".git/.scripts/commands/fmt/fmt.sh" --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
use frame_benchmarking::v2::*;
|
||||
#[allow(unused_imports)]
|
||||
use frame_support_test::Config;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
#[benchmark]
|
||||
fn bench(x: Linear<3, 1>) {
|
||||
#[block]
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -1,5 +0,0 @@
|
||||
error: The start of a `ParamRange` must be less than or equal to the end
|
||||
--> tests/benchmark_ui/bad_param_range.rs:10:21
|
||||
|
|
||||
10 | fn bench(x: Linear<3, 1>) {
|
||||
| ^
|
||||
@@ -0,0 +1,28 @@
|
||||
use frame_benchmarking::v2::*;
|
||||
use frame_support_test::Config;
|
||||
use frame_support::parameter_types;
|
||||
|
||||
#[benchmarks]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
const MY_CONST: u32 = 100;
|
||||
|
||||
const fn my_fn() -> u32 {
|
||||
200
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
const MyConst: u32 = MY_CONST;
|
||||
}
|
||||
|
||||
#[benchmark(skip_meta, extra)]
|
||||
fn bench(a: Linear<{MY_CONST * 2}, {my_fn() + MyConst::get()}>) {
|
||||
let a = 2 + 2;
|
||||
#[block]
|
||||
{}
|
||||
assert_eq!(a, 4);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Reference in New Issue
Block a user