-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): add tests for CI automation testing
- Loading branch information
1 parent
f9a4563
commit aa1bbd5
Showing
5 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Build & Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build and Test | ||
run: | | ||
./configure && make && make test && export LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH && make run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
Makefile | ||
lib/ | ||
objs/ | ||
bin/ | ||
build/ | ||
conf/melon.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "mln_string.h" | ||
#include "mln_aes.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
mln_aes_t a; | ||
char p[] = "1234567890123456"; | ||
mln_string_t s; | ||
|
||
if (mln_aes_init(&a, (mln_u8ptr_t)"abcdefghijklmnop", M_AES_128) < 0) { | ||
fprintf(stderr, "aes init failed\n"); | ||
return -1; | ||
} | ||
|
||
mln_string_set(&s, p); | ||
if (mln_aes_encrypt(&a, s.data) < 0) { | ||
fprintf(stderr, "aes encrypt failed\n"); | ||
return -1; | ||
} | ||
write(STDOUT_FILENO, s.data, s.len); | ||
write(STDOUT_FILENO, "\n", 1); | ||
|
||
if (mln_aes_decrypt(&a, s.data) < 0) { | ||
fprintf(stderr, "aes decrypt failed\n"); | ||
return -1; | ||
} | ||
write(STDOUT_FILENO, s.data, s.len); | ||
write(STDOUT_FILENO, "\n", 1); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "mln_string.h" | ||
#include "mln_base64.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
mln_string_t text = mln_string("Hello"); | ||
mln_string_t tmp; | ||
mln_u8ptr_t p1, p2; | ||
mln_uauto_t len1, len2; | ||
|
||
if (mln_base64_encode(text.data, text.len, &p1, &len1) < 0) { | ||
fprintf(stderr, "encode failed\n"); | ||
return -1; | ||
} | ||
mln_string_nset(&tmp, p1, len1); | ||
write(STDOUT_FILENO, tmp.data, tmp.len); | ||
write(STDOUT_FILENO, "\n", 1); | ||
|
||
if (mln_base64_decode(p1, len1, &p2, &len2) < 0) { | ||
fprintf(stderr, "decode failed\n"); | ||
return -1; | ||
} | ||
mln_string_nset(&tmp, p2, len2); | ||
write(STDOUT_FILENO, tmp.data, tmp.len); | ||
write(STDOUT_FILENO, "\n", 1); | ||
|
||
mln_base64_free(p1); | ||
mln_base64_free(p2); | ||
|
||
return 0; | ||
} |