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)]
11pub enum MainCmd {
12 Statetest(statetest::Cmd),
14 Stest(statetest::Cmd),
16 Evm(evmrunner::Cmd),
18 Bytecode(bytecode::Cmd),
20 Bench(bench::Cmd),
22 Blockchaintest(blockchaintest::Cmd),
24 Btest(blockchaintest::Cmd),
26}
27
28#[derive(Debug, thiserror::Error)]
29pub enum Error {
30 #[error(transparent)]
31 Statetest(#[from] statetest::Error),
32 #[error(transparent)]
33 Blockchaintest(#[from] blockchaintest::Error),
34 #[error(transparent)]
35 EvmRunnerErrors(#[from] evmrunner::Errors),
36 #[error("Custom error: {0}")]
37 Custom(&'static str),
38}
39
40impl MainCmd {
41 pub fn run(&self) -> Result<(), Error> {
42 match self {
43 Self::Statetest(cmd) | Self::Stest(cmd) => cmd.run()?,
44 Self::Evm(cmd) => cmd.run()?,
45 Self::Bytecode(cmd) => {
46 cmd.run()?;
47 }
48 Self::Bench(cmd) => {
49 cmd.run();
50 }
51 Self::Blockchaintest(cmd) | Self::Btest(cmd) => cmd.run()?,
52 }
53 Ok(())
54 }
55}