File tree Expand file tree Collapse file tree 3 files changed +48
-6
lines changed
lib_examples/base64_example Expand file tree Collapse file tree 3 files changed +48
-6
lines changed Original file line number Diff line number Diff line change 1+ name : Run base64_example Tests on PR
2+ on :
3+ pull_request :
4+ paths :
5+ - " lib_examples/base64_example/**"
6+ schedule :
7+ - cron : " 0 2 * * *"
8+ workflow_dispatch :
9+
10+ jobs :
11+ test :
12+ defaults :
13+ run :
14+ working-directory : lib_examples/base64_example
15+ permissions :
16+ issues : write
17+
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+
22+ - name : Install Nargo
23+ 24+ with :
25+ toolchain : stable
26+
27+ - name : Run Noir unit tests
28+ run : |
29+ nargo test
30+
31+ - name : Create issue on failure (nightly)
32+ if : failure() && github.event_name == 'schedule'
33+ uses : actions/github-script@v6
34+ with :
35+ script : |
36+ github.issues.create({
37+ owner: context.repo.owner,
38+ repo: context.repo.repo,
39+ title: '[Nightly] base64_example workflow failed',
40+ body: `The nightly base64_example workflow failed. Please investigate.\n\n/cc @noir-lang/developerrelations`,
41+ labels: ['nightly', 'bug']
42+ })
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ authors = [""]
55compiler_version = " >=0.36.0"
66
77[dependencies ]
8- base64 = {tag = " v0.3.1 " , git = " https://github.com/noir-lang/noir_base64.git" }
8+ noir_base64 = {tag = " v0.4.2 " , git = " https://github.com/noir-lang/noir_base64.git" }
Original file line number Diff line number Diff line change 11mod test_inputs ;
2- use base64:: { BASE64_ENCODER , BASE64_DECODER } ;
2+ use noir_base64 ;
33
44// Choose number of encode and/or decode runs
55pub global ENCODE_RUNS : u32 = 3 ;
@@ -13,20 +13,20 @@ comptime global U: u32 = comptime { TEST_INPUT.as_bytes().len() };
1313comptime global B : u32 = comptime {
1414 let mut q = U / 3 ;
1515 let r = U - q * 3 ;
16- if (r > 0 ) { q += 1 ; }; // round up since encoded base64 gets padded
16+ if (r > 0 ) { q += 1 ; } // round up since encoded base64 gets padded
1717 q * 4
1818};
1919
2020fn main (input : str <U >, base64_encoded : str <B >) {
2121 for _ in 0 ..ENCODE_RUNS {
22- let _encoded : [u8 ; B ] = BASE64_ENCODER . encode (input .as_bytes ());
22+ let _encoded : [u8 ; B ] = noir_base64:: BASE64_ENCODER:: encode (input .as_bytes ());
2323 }
2424 for _ in 0 ..DECODE_RUNS {
25- let _decoded : [u8 ; U ] = BASE64_DECODER . decode (base64_encoded .as_bytes ());
25+ let _decoded : [u8 ; U ] = noir_base64:: BASE64_DECODER:: decode (base64_encoded .as_bytes ());
2626 }
2727}
2828
2929#[test]
3030fn test () {
3131 main (TEST_INPUT , TEST_BASE64_ENCODED );
32- }
32+ }
You can’t perform that action at this time.
0 commit comments