2 releases

0.1.2 Dec 24, 2021
0.1.0 Dec 19, 2021

#2365 in Command line utilities

21 downloads per month

MIT license

270KB
854 lines

Codesim

Diff two single C++ code file.

Installation

Ensure you have installed clang in your computer, and corresponding nm, objdump has been properly set in your path env.

Run the following in your terminal.

curl -fsSL https://bina.egoist.sh/yjl9903/Codesim | sh

Or you can manually install codesim. Get the latest Rust.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install codesim with cargo.

cargo install codesim

Install codesim locally.

cargo install --path .

Mac OS / Linux is highly recommended.

Usage

$ codesim --help
codesim 0.1.0
Diff two single C++ code file

USAGE:
    codesim [FLAGS] [OPTIONS] [--] [ARGS]

FLAGS:
    -h, --help            Prints help information
        --norm            Normalize final score
        --skip-compile    Skip compile
    -V, --version         Prints version information
    -v, --verbose         Verbose log

OPTIONS:
        --csv <csv>           Output CSV
        --files <files>...    extra files

ARGS:
    <code1>    source code
    <code2>    target code

For example, run codesim on the example codes.

codesim examples/aplusb.cpp examples/cplusd.cpp
codesim examples/cplusd.cpp examples/aplusb.cpp

If you have not installed clang, you can compile two codes manually, and pass --skip-compile to codesim.

codesim a.out b.out --skip-compile

You can also run codesim on multiple files pairwise.

codesim --files examples/Sum/sample1.c examples/Sum/sample2.c examples/Sum/sample3.c

Docker

Dockerfile is provided. You can use it to avoid installing deps in your machine.

Dependencies

~7–16MB
~227K SLoC