Skip to content

Commit

Permalink
Rename bubble sort to quadratic sort (#820)
Browse files Browse the repository at this point in the history
In preparation for #813

Also stop hard-coding the examples in the examples-builder.
  • Loading branch information
matthiasgoergens authored Jan 9, 2025
1 parent dfce3af commit 2cf1853
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion ceno_host/tests/test_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn test_bubble_sorting() -> Result<()> {

let all_messages = messages_to_strings(&ceno_host::run(
CENO_PLATFORM,
ceno_examples::bubble_sorting,
ceno_examples::quadratic_sorting,
&hints,
));
for msg in &all_messages {
Expand Down
3 changes: 3 additions & 0 deletions examples-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ license.workspace = true
name = "ceno-examples"
repository.workspace = true
version.workspace = true

[build-dependencies]
glob = "0.3"
24 changes: 7 additions & 17 deletions examples-builder/build.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
use glob::glob;
use std::{
fs::{File, read_dir},
io::{self, Write},
path::Path,
process::Command,
};

/// Add each example to this list.
///
/// Contact Matthias, if your examples get complicated enough to need their own crates, instead of just being one file.
const EXAMPLES: &[&str] = &[
"ceno_rt_alloc",
"ceno_rt_io",
"ceno_rt_mem",
"ceno_rt_mini",
"ceno_rt_panic",
"ceno_rt_keccak",
"hints",
"sorting",
"median",
"bubble_sorting",
"hashing",
];
const CARGO_MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR");

fn rerun_all_but_target(dir: &Path) {
Expand Down Expand Up @@ -51,7 +36,12 @@ fn build_elfs() {
io::stderr().write_all(&output.stderr).unwrap();
panic!("cargo build of examples failed.");
}
for example in EXAMPLES {
// Contact Matthias, if your examples get complicated enough to need their own crates, instead of just being one file.
for example in glob("../examples/examples/*.rs")
.unwrap()
.map(Result::unwrap)
{
let example = example.file_stem().unwrap().to_str().unwrap();
writeln!(
dest,
r#"#[allow(non_upper_case_globals)]
Expand Down
File renamed without changes.

0 comments on commit 2cf1853

Please sign in to comment.