-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
314 additions
and
0 deletions.
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
44 changes: 44 additions & 0 deletions
44
tests/cpp/custom_cases/getelementptr_as_constant/getelementptr_as_constant.cpp
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,44 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
struct lumpinfo_s | ||
{ | ||
lumpinfo_s * next; | ||
lumpinfo_s * prev; | ||
int data1; | ||
}; | ||
|
||
lumpinfo_s first; | ||
|
||
[[circuit]] int list_demo(int unused) { | ||
|
||
first.next = first.prev = &first; | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << 0 <<std::endl; | ||
#endif | ||
|
||
return 0; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
int a = read_uint<int>(input_json, 0); | ||
|
||
list_demo(a); | ||
return 0; | ||
} | ||
#endif |
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,41 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
[[circuit]] uint32_t test_func(char *buf) { | ||
uint32_t out = 0; | ||
memset((void*)buf, 5, 2); | ||
out = buf[0] + buf[1]; | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << out <<std::endl; | ||
#endif | ||
|
||
return out; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
std::string s = read_string(input_json, 0); | ||
|
||
char* buf = new char[s.size()]; | ||
strcpy(buf, s.c_str()); | ||
|
||
test_func(buf); | ||
|
||
delete[] buf; | ||
return 0; | ||
} | ||
#endif |
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,36 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
[[circuit]] int test_func(const char *s1, const char *s2) { | ||
int out = strcmp(s1, s2); | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << out <<std::endl; | ||
#endif | ||
|
||
return out; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
std::string s1 = read_string(input_json, 0); | ||
std::string s2 = read_string(input_json, 1); | ||
|
||
test_func(s1.c_str(), s2.c_str()); | ||
|
||
return 0; | ||
} | ||
#endif |
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,40 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
[[circuit]] uint32_t test_func(char *dst, const char *src) { | ||
uint32_t out = 0; | ||
char* ch = strcpy(dst, src); | ||
out = ch[0] + ch[1]; | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << out <<std::endl; | ||
#endif | ||
|
||
return out; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
std::string s = read_string(input_json, 0); | ||
|
||
char* buf = new char[s.size()]; | ||
|
||
test_func(buf, s.c_str()); | ||
|
||
delete[] buf; | ||
return 0; | ||
} | ||
#endif |
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,36 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
[[circuit]] uint32_t test_func(const char *buf) { | ||
uint32_t out = 0; | ||
out = strlen(buf); | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << out <<std::endl; | ||
#endif | ||
|
||
return out; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
std::string s = read_string(input_json, 0); | ||
|
||
test_func(s.c_str()); | ||
|
||
return 0; | ||
} | ||
#endif |
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,38 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
[[circuit]] int test_func(const char *s1, const char *s2, uint32_t n) { | ||
int out = strncmp(s1, s2, n); | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << out <<std::endl; | ||
#endif | ||
|
||
return out; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
std::string s1 = read_string(input_json, 0); | ||
std::string s2 = read_string(input_json, 1); | ||
uint32_t n = read_uint<uint32_t>(input_json, 2); | ||
|
||
|
||
test_func(s1.c_str(), s2.c_str(), n); | ||
|
||
return 0; | ||
} | ||
#endif |
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,42 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../read_boost_json.hpp" | ||
#include <cstdint> | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
[[circuit]] uint32_t test_func(char *dst, const char *src, uint32_t n) { | ||
uint32_t out = 0; | ||
char* ch = strncpy(dst, src, n); | ||
out = ch[0] + ch[1]; | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << out <<std::endl; | ||
#endif | ||
|
||
return out; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
std::string s = read_string(input_json, 0); | ||
uint32_t n = read_uint<uint32_t>(input_json, 2); | ||
|
||
char* buf = new char[s.size()]; | ||
memset((void*)buf, 0, s.size()); | ||
|
||
test_func(buf, s.c_str(), n); | ||
|
||
delete[] buf; | ||
return 0; | ||
} | ||
#endif |
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 @@ | ||
[ {"string": "abc"}, {"string": "abx"}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "abx"}, {"int": 3}] |
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 @@ | ||
[ {"int": 10}] |
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 @@ | ||
[ {"string": "ab"}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "abc"}] |
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 @@ | ||
[ {"string": "abx"}, {"string": "abc"}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "ab"}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "abc"}] |
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 @@ | ||
[ {"string": "abc"}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "abc"}, {"int": 3}] |
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 @@ | ||
[ {"string": "abx"}, {"string": "abc"}, {"int": 3}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "abx"}, {"int": 2}] |
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 @@ | ||
[ {"string": "ab"}, {"string": "ab"}, {"int": 3}] |
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 @@ | ||
[ {"string": "abc"}, {"string": "abc"}, {"int": 2}] |