1pub mod bench;
2pub mod blockchaintest;
3pub mod bytecode;
4pub mod evmrunner;
5pub mod statetest;
6
7use clap::Parser;
8
9#[derive(Parser, Debug)]
10#[command(infer_subcommands = true)]
11#[allow(clippy::large_enum_variant)]
12pub enum MainCmd {
13 Statetest(statetest::Cmd),
15 Stest(statetest::Cmd),
17 Evm(evmrunner::Cmd),
19 Bytecode(bytecode::Cmd),
21 Bench(bench::Cmd),
23 Blockchaintest(blockchaintest::Cmd),
25 Btest(blockchaintest::Cmd),
27}
28
29#[derive(Debug, thiserror::Error)]
30pub enum Error {
31 #[error(transparent)]
32 Statetest(#[from] statetest::Error),
33 #[error(transparent)]
34 Blockchaintest(#[from] blockchaintest::Error),
35 #[error(transparent)]
36 EvmRunnerErrors(#[from] evmrunner::Errors),
37 #[error("Custom error: {0}")]
38 Custom(&'static str),
39}
40
41impl MainCmd {
42 pub fn run(&self) -> Result<(), Error> {
43 match self {
44 Self::Statetest(cmd) | Self::Stest(cmd) => cmd.run()?,
45 Self::Evm(cmd) => cmd.run()?,
46 Self::Bytecode(cmd) => {
47 cmd.run()?;
48 }
49 Self::Bench(cmd) => {
50 cmd.run();
51 }
52 Self::Blockchaintest(cmd) | Self::Btest(cmd) => cmd.run()?,
53 }
54 Ok(())
55 }
56}