diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-26 01:47:32 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-26 01:47:32 +0100 |
| commit | c52dbf5513ae7f106634967162da5cfb01dc5af3 (patch) | |
| tree | b6715d0fdacebd48491b9b05cf85f1d92028f84b /examples/opt/opt.cc | |
| parent | 01565adb9cf5ef991196f56c7f5f7b6161daa005 (diff) | |
feat: SOCL v1.0.2, changelog soon!v1.0.2
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples/opt/opt.cc')
| -rw-r--r-- | examples/opt/opt.cc | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/examples/opt/opt.cc b/examples/opt/opt.cc deleted file mode 100644 index a914d8d..0000000 --- a/examples/opt/opt.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - string checksum example - written by Amlal El Mahrouss. - licensed under the MIT license - */ - -#include <lib/logic/opt.hpp> -#include <lib/io/print.hpp> -#include <string> - -static const char do_hash(const std::string& in) -{ - int hash = 0; - - for (long index = 0; index < in.size(); ++index) - { - hash += in[index]; - } - - return hash; -} - -static auto do_some(const std::string recv_data, const std::string check_data) -{ - const int hash_to_check = do_hash(check_data); /* here we assume this should match opt_hash */ - const int opt_hash = do_hash(recv_data); /* we assume that the hash is correct */ - - auto opt = snu::opt::opt(snu::opt::eval_eq(hash_to_check, opt_hash)); /* do the compute */ - return opt; -} - -/* finally test it */ -int main(int argc, char** argv) -{ - // ... let's assume we fetch data from network... - - snu::println("Testing data..."); - - auto opt = do_some("Ohio", "Ohio"); - opt.expect("Checksum failed, Ohio isn't Ohio!"); - - - return 0; -} |
