1
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
#include "my_config.h"
19
#include <my_global.h>
22
#include <sql_string.h>
23
#include <my_decimal.h>
28
Test my_decimal constuctor and assignement operators
31
test_copy_and_compare()
37
ok(ulonglong2decimal(val,&d1) == 0, "Pass");
41
ok(my_decimal_cmp(&d1, &d2) == 0, "Pass");
42
ok(my_decimal_cmp(&d2, &d3) == 0, "Pass");
43
ok(my_decimal_cmp(&d3, &d1) == 0,"Pass");
45
ulonglong val1, val2, val3;
46
ok(decimal2ulonglong(&d1, &val1) == 0, "Pass");
47
ok(decimal2ulonglong(&d2, &val2) == 0,"Pass");
48
ok(decimal2ulonglong(&d3, &val3) == 0,"Pass");
50
ok(val == val1,"Pass");
51
ok(val == val2,"Pass");
52
ok(val == val3,"Pass");
54
// The CTOR/operator=() generated by the compiler would fail here:
56
ok(ulonglong2decimal(val, &d1) == 0,"Pass");
57
ok(my_decimal_cmp(&d1, &d2) == 1,"Pass");
58
ok(my_decimal_cmp(&d1, &d3) == 1,"Pass");
67
diag("Testing my_decimal constructor and assignment operators");
69
test_copy_and_compare();