00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <basis/guards.h>
00020 #include <basis/istring.h>
00021 #include <geometric/cartesian_objects.h>
00022 #include <geometric/circle.h>
00023 #include <geometric/ellipse.h>
00024 #include <geometric/line.cpp>
00025 #include <geometric/screen_rectangle.h>
00026 #include <geometric/rectangle.cpp>
00027 #include <geometric/warper.cpp>
00028 #include <geometric/triangle.h>
00029 #include <data_struct/static_memory_gremlin.h>
00030
00031 HOOPLE_STARTUP_CODE;
00032
00033 using namespace geometric;
00034
00035 int main(int formal(argc), char *formal(argv)[])
00036 {
00037
00038 circle fred;
00039 ellipse tobias;
00040 line<double> slugmart;
00041 rectangle<double> burger;
00042 rectangle_warper<double> space_warp(burger, burger);
00043 triangle euclid;
00044
00045 burger = cartesian_rectangle(23, 19, 82, 745);
00046 if (!burger.from_text(istring("84.0 290.0 10.0 912.0")))
00047 deadly_error("t_geometry", "cartesian from_text test", "returned failure");
00048 if (burger != cartesian_rectangle(84.0, 290.0, 10.0, 912.0))
00049 deadly_error("t_geometry", "cartesian from_text test", "didn't compare with expected value");
00050
00051 screen_rectangle xingu(23, 19, 82, 745);
00052 if (xingu != screen_rectangle(screen_point(23, 19), screen_point(82, 745)))
00053 deadly_error("t_geometry", "screen test", "construction disagreed with expectations");
00054 if (!xingu.from_text(istring("84 290 10 912")))
00055 deadly_error("t_geometry", "screen from_text test", "returned failure");
00056 if (xingu != screen_rectangle(84, 290, 10, 912))
00057 deadly_error("t_geometry", "screen from_text test", "didn't compare with expected value");
00058
00059 screen_rectangle guiness(-223, 19, 82, -745);
00060 if (guiness != screen_rectangle(screen_point(-223, 19), screen_point(82, -745)))
00061 deadly_error("t_geometry", "screen test", "construction disagreed with expectations");
00062 if (!guiness.from_text(istring("-84 290 -10 912")))
00063 deadly_error("t_geometry", "screen from_text test", "returned failure");
00064 if (guiness != screen_rectangle(-84, 290, -10, 912))
00065 deadly_error("t_geometry", "screen from_text test", "didn't compare with expected value");
00066
00067 guards::alert_message(istring(istring::SPRINTF, "the string form is %s.", guiness.text_form().s()).s());
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 guards::alert_message("geometric:: works for those functions tested.");
00081
00082 return 0;
00083 }
00084