Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: initial tool #773

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 169 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
members = [
"bin",

"bench",

"book-lints",

"hls",
Expand Down Expand Up @@ -46,7 +48,8 @@ peekmore = "1.3.0"
pest = "2.7.11"
pest_derive = "2.7.11"
regex = "1.10.5"
serde = { version = "1.0.209", features = ["derive"] }
rust-embed = "8.5.0"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.122"
sha-1 = "0.10.1"
strsim = "0.11.1"
Expand Down
17 changes: 17 additions & 0 deletions bench/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "hemtt-bench"
version = "1.0.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
hemtt-common = { path = "../libs/common" }
hemtt-sqf = { path = "../libs/sqf" }
hemtt-preprocessor = { path = "../libs/preprocessor" }
hemtt-workspace = { path = "../libs/workspace" }

automod = { workspace = true }
arma-bench = { git = "https://github.com/brettmayson/arma-bench", branch = "main" }
serde_json = { workspace = true }
35 changes: 35 additions & 0 deletions bench/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! A simple way to test SQF with various compilation
//!
//! Requires a running instance of the `arma-bench` server. <https://github.com/brettmayson/arma-bench>
//!
//! I don't know how we want to use this yet, but at least it is easier than launching Arma

use arma_bench::{Client, ServerConfig};
use sqf::display_compare;

mod sqf;

fn main() {
let client = Client::connect(
&std::env::var("ARMA_BENCH_HOST").expect("ARMA_BENCH_HOST env var must be set"),
&ServerConfig::default(),
)
.expect("Failed to connect to server");

let content = r#"
params ["_a", ["_b", configNull], ["_c", 0, [0]]];
params [["_cannot", []]];

x = 180 / 3.1413;
y = "A" + toUpper "b";

_a = -5;
_b = sqrt 2;
_c = sqrt -1;

toUpper "🌭";
"#;

let res = sqf::compare(&client, content).expect("Failed to compare");
display_compare(&res);
}
Loading
Loading