use GLib.Test framework for testing
This commit is contained in:
parent
ac4338a57c
commit
346be0e9ac
@ -1,8 +1,15 @@
|
|||||||
using LibSernatur.Misc;
|
using LibSernatur.Misc;
|
||||||
|
|
||||||
public static int main (string[] args) {
|
void add_money_tests () {
|
||||||
assert (Money.format_int (100000) == "$100.000");
|
Test.add_func ("/sernatur/test/money", () => {
|
||||||
assert (Money.format_uint (100000) == "$100.000");
|
assert (Money.format_int (100000) == "$100.000");
|
||||||
assert (Money.format_string ("100000") == "$100.000");
|
assert (Money.format_uint (100000) == "$100.000");
|
||||||
return 0;
|
assert (Money.format_string ("100000") == "$100.000");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (string[] args) {
|
||||||
|
Test.init (ref args);
|
||||||
|
add_money_tests ();
|
||||||
|
return Test.run ();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
using LibSernatur.Misc;
|
using LibSernatur.Misc;
|
||||||
|
|
||||||
public static int main (string[] args) {
|
void add_percentage_tests () {
|
||||||
assert (Percentage.format_float ((float) 0.43) == "43%");
|
Test.add_func ("/sernatur/test/percentage", () => {
|
||||||
assert (Percentage.format_float ((float) 1) == "100%");
|
assert (Percentage.format_float ((float) 0.43) == "43%");
|
||||||
assert (Percentage.format_double (0.43) == "43%");
|
assert (Percentage.format_float ((float) 1) == "100%");
|
||||||
assert (Percentage.format_double (1) == "100%");
|
assert (Percentage.format_double (0.43) == "43%");
|
||||||
return 0;
|
assert (Percentage.format_double (1) == "100%");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (string[] args) {
|
||||||
|
Test.init (ref args);
|
||||||
|
add_percentage_tests ();
|
||||||
|
return Test.run ();
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,31 @@
|
|||||||
using LibSernatur.Misc;
|
using LibSernatur.Misc;
|
||||||
|
|
||||||
public static int main (string[] args) {
|
void add_rut_tests () {
|
||||||
try {
|
Test.add_func ("/sernatur/test/rut", () => {
|
||||||
Rut rut = new Rut ("18166316-2");
|
try {
|
||||||
assert (rut.get_clean_rut () == "181663162");
|
Rut rut = new Rut ("18166316-2");
|
||||||
assert (rut.get_rut () == "18.166.316-2");
|
assert (rut.get_clean_rut () == "181663162");
|
||||||
assert (rut.type () == Rut.Type.RUN);
|
assert (rut.get_rut () == "18.166.316-2");
|
||||||
|
assert (rut.type () == Rut.Type.RUN);
|
||||||
|
|
||||||
rut = new Rut ("20380508-k");
|
rut = new Rut ("20380508-k");
|
||||||
assert (rut.get_clean_rut () == "20380508K");
|
assert (rut.get_clean_rut () == "20380508K");
|
||||||
assert (rut.get_rut () == "20.380.508-K");
|
assert (rut.get_rut () == "20.380.508-K");
|
||||||
assert (rut.type () == Rut.Type.RUN);
|
assert (rut.type () == Rut.Type.RUN);
|
||||||
|
|
||||||
rut = new Rut ("50380508-1");
|
rut = new Rut ("50380508-1");
|
||||||
assert (rut.get_clean_rut () == "503805081");
|
assert (rut.get_clean_rut () == "503805081");
|
||||||
assert (rut.get_rut () == "50.380.508-1");
|
assert (rut.get_rut () == "50.380.508-1");
|
||||||
assert (rut.type () == Rut.Type.RUT);
|
assert (rut.type () == Rut.Type.RUT);
|
||||||
}
|
}
|
||||||
catch (Error e) {
|
catch (Error e) {
|
||||||
error (e.message);
|
error (e.message);
|
||||||
}
|
}
|
||||||
return 0;
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (string[] args) {
|
||||||
|
Test.init (ref args);
|
||||||
|
add_rut_tests ();
|
||||||
|
return Test.run ();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user