Skip to content

Commit

Permalink
fixing up unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
objeck committed Feb 17, 2024
1 parent 67e2acb commit c78a154
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
16 changes: 8 additions & 8 deletions programs/deploy/encrypt_7.obs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

class Encryption {
function : Main(args : String[]) ~ Nil {
in := "Nas is like..."->ToByteArray();
hash := Encryption.Hash->SHA256(in);
input := "Nas is like..."->ToByteArray();
hash := Encryption.Hash->SHA256(input);

in := "The quick brown fox jumped over the lazy dog's back"->ToByteArray();
hash := Encryption.Hash->MD5(in);
input := "The quick brown fox jumped over the lazy dog's back"->ToByteArray();
hash := Encryption.Hash->MD5(input);
hash->ToHexString()->PrintLine();

in := "Rosetta Code"->ToByteArray();
hash := Encryption.Hash->RIPEMD160(in);
input := "Rosetta Code"->ToByteArray();
hash := Encryption.Hash->RIPEMD160(input);
hash->ToHexString()->PrintLine();

key := "Forest Room 5"->ToByteArray();
in := "I switched my motto / Instead of saying f*ck tomorrow, that buck that bought a bottle could've struck the lotto."->ToByteArray();
encrypted := Encryption.Encrypt->AES256(key, in);
input := "I switched my motto / Instead of saying f*ck tomorrow, that buck that bought a bottle could've struck the lotto."->ToByteArray();
encrypted := Encryption.Encrypt->AES256(key, input);
if(encrypted <> Nil) {
decprypted := Encryption.Decrypt->AES256(key, encrypted);
if(decprypted <> Nil) {
Expand Down
56 changes: 28 additions & 28 deletions programs/deploy/xml_2.obs
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ use Data.XML;

class Test {
function : Main(args : String[]) ~ Nil {
in := "";
in += "<inventory title=\"OmniCorp Store #45x10^3\">";
in += "<section name=\"health\">";
in += "<item upc=\"123456789\" stock=\"12\">";
in += "<name>Invisibility Cream</name>";
in += "<price>14.50</price>";
in += "<description>Makes you invisible</description>";
in += "</item>";
in += "<item upc=\"445322344\" stock=\"18\">";
in += "<name>Levitation Salve</name>";
in += "<price>23.99</price>";
in += "<description>Levitate yourself for up to 3 hours per application</description>";
in += "</item>";
in += "</section>";
in += "<section name=\"food\">";
in += "<item upc=\"485672034\" stock=\"653\">";
in += "<name>Blork and Freen Instameal</name>";
in += "<price>4.95</price>";
in += "<description>A tasty meal in a tablet; just add water</description>";
in += "</item>";
in += "<item upc=\"132957764\" stock=\"44\">";
in += "<name>Grob winglets</name>";
in += "<price>3.56</price>";
in += "<description>Tender winglets of Grob. Just add water</description>";
in += "</item>";
in += "</section>";
in += "</inventory>";
input := "";
input += "<inventory title=\"OmniCorp Store #45x10^3\">";
input += "<section name=\"health\">";
input += "<item upc=\"123456789\" stock=\"12\">";
input += "<name>Invisibility Cream</name>";
input += "<price>14.50</price>";
input += "<description>Makes you invisible</description>";
input += "</item>";
input += "<item upc=\"445322344\" stock=\"18\">";
input += "<name>Levitation Salve</name>";
input += "<price>23.99</price>";
input += "<description>Levitate yourself for up to 3 hours per application</description>";
input += "</item>";
input += "</section>";
input += "<section name=\"food\">";
input += "<item upc=\"485672034\" stock=\"653\">";
input += "<name>Blork and Freen Instameal</name>";
input += "<price>4.95</price>";
input += "<description>A tasty meal input a tablet; just add water</description>";
input += "</item>";
input += "<item upc=\"132957764\" stock=\"44\">";
input += "<name>Grob winglets</name>";
input += "<price>3.56</price>";
input += "<description>Tender winglets of Grob. Just add water</description>";
input += "</item>";
input += "</section>";
input += "</inventory>";

parser := XmlParser->New(in);
parser := XmlParser->New(input);
if(parser->Parse()) {
# get first item
results := parser->FindElements("/inventory/section[1]/item[1]")<XmlElement>;
Expand Down

0 comments on commit c78a154

Please sign in to comment.