Skip to content

Commit

Permalink
add(utils): protobuf template
Browse files Browse the repository at this point in the history
Starting to harmonise the test vectors with a common template that
contains the minimum fields for the tests and set of vectors.
  • Loading branch information
JulioLoayzaM committed Nov 21, 2024
1 parent dae2783 commit 8df71ab
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
9 changes: 9 additions & 0 deletions utils/add_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ def usage(code: int = 0):
Path(root / "vectors" / f"_{primitive}").mkdir(0o755, parents=False, exist_ok=True)
print("[OK ] Create vectors directory")

print("[...] Create .proto file", end="\r")
template = (
Path("utils/templates/new-vectors.proto")
.read_text()
.replace("PLACEHOLDER", primitive)
)
Path(root / f"vectors/{primitive}.proto").write_text(template)
print("[OK ] Create .proto file")

# Wrappers
print("[...] Create wrappers directory", end="\r")
Path(root / f"resources/wrappers/{primitive}").mkdir(
Expand Down
34 changes: 34 additions & 0 deletions utils/templates/new-vectors.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
syntax = "proto3";

package crypto_condor;

// A single PLACEHOLDER test vector.
message PLACEHOLDERTest{
// The test ID, unique in its set of vectors.
int32 id = 1;
// The type of test. One of: valid, invalid, acceptable.
string type = 2;
// A comment on the test.
string comment = 3;
// Flags that categorize this test.
repeated string flags = 4;
}

// A set of PLACEHOLDER test vectors.
message PLACEHOLDERVectors{
// The source of the test vectors.
string source = 1;
// Description of the source.
string source_desc = 2;
// The URL of the source.
string source_url = 3;
// Whether these are compliance test vectors or not.
bool compliance = 4;
// A dictionary of test flags and their description.
map<string, string> notes = 5;

// FIXME: some parameter that categorizes the vectors.
string parameter = 6;
// The test vectors.
repeated PLACEHOLDERTest tests = 7;
}

0 comments on commit 8df71ab

Please sign in to comment.