~drizzle-trunk/drizzle/development

1377.8.2 by Paweł Blokus
created files for temporal tests
1
/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2010 Pawel Blokus
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
21
#ifndef UNITTESTS_GENERATOR_H
22
#define UNITTESTS_GENERATOR_H
23
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
24
#include <config.h>
1377.8.2 by Paweł Blokus
created files for temporal tests
25
26
namespace drizzled
27
{
28
  class Date;
1377.8.23 by Paweł Blokus
added generator for TemporalFormat
29
  class TemporalFormat;
1377.8.32 by Paweł Blokus
setters to TemporalInterval
30
  class Temporal;
31
  class Time;
32
  class DateTime;
33
  class Timestamp;
34
  class MicroTimestamp;
35
  class NanoTimestamp;
1377.8.2 by Paweł Blokus
created files for temporal tests
36
}
37
1377.8.36 by Paweł Blokus
changed Generator to TemporalGenerator
38
class TemporalGenerator 
1377.8.2 by Paweł Blokus
created files for temporal tests
39
{
40
public:
41
1377.8.20 by Paweł Blokus
moved shared generators to Temporal
42
  class TemporalGen
43
  {
44
  public:
45
    static void leap_day_in_leap_year(drizzled::Temporal *temporal);
46
    static void leap_day_in_non_leap_year(drizzled::Temporal *temporal);
47
    static void make_min_time(drizzled::Temporal *temporal);
48
    static void make_max_time(drizzled::Temporal *temporal);
49
  };
50
  
1377.8.2 by Paweł Blokus
created files for temporal tests
51
  class DateGen
52
  {
53
  public:
54
    static void make_date(drizzled::Date *date, uint32_t years, uint32_t months, uint32_t days);
1377.8.20 by Paweł Blokus
moved shared generators to Temporal
55
    static void make_valid_date(drizzled::Date *date);  
1377.8.2 by Paweł Blokus
created files for temporal tests
56
  };
1377.8.5 by Paweł Blokus
removed an undefined character from the decimal.cc file
57
  
1377.8.18 by Paweł Blokus
added Time_test to include.am
58
  class TimeGen
59
  {
60
  public:
1377.8.34 by Paweł Blokus
take microsedonds into account where they are used in datetime and time
61
    static void make_time(drizzled::Time *time, uint32_t hours, uint32_t minutes, uint32_t seconds,
62
                          uint32_t useconds = 0);
1377.8.18 by Paweł Blokus
added Time_test to include.am
63
  };
64
  
1377.8.5 by Paweł Blokus
removed an undefined character from the decimal.cc file
65
  class DateTimeGen
66
  {
1377.8.20 by Paweł Blokus
moved shared generators to Temporal
67
  public:
68
    static void make_datetime(drizzled::DateTime *datetime,
1377.8.22 by Paweł Blokus
added missing time component parameters to timestamp generator
69
                              uint32_t years, uint32_t months, uint32_t days, uint32_t hours,
1377.8.34 by Paweł Blokus
take microsedonds into account where they are used in datetime and time
70
                              uint32_t minutes, uint32_t seconds, uint32_t useconds = 0);
1377.8.20 by Paweł Blokus
moved shared generators to Temporal
71
    static void make_valid_datetime(drizzled::DateTime *datetime);
1377.8.5 by Paweł Blokus
removed an undefined character from the decimal.cc file
72
  };
1377.8.6 by Paweł Blokus
added tests for Date operators used for comparing with timestamps
73
  
74
  class TimestampGen
75
  {
1377.8.20 by Paweł Blokus
moved shared generators to Temporal
76
  public:
77
    static void make_timestamp(drizzled::Timestamp *timestamp,
1377.8.22 by Paweł Blokus
added missing time component parameters to timestamp generator
78
                               uint32_t years, uint32_t months, uint32_t days, uint32_t hours,
79
                               uint32_t minutes, uint32_t seconds);
80
    static void make_micro_timestamp(drizzled::MicroTimestamp *timestamp,
81
                              uint32_t years, uint32_t months, uint32_t days, uint32_t hours,
82
                              uint32_t minutes, uint32_t seconds, uint32_t microseconds);
83
    static void make_nano_timestamp(drizzled::NanoTimestamp *timestamp,
84
                                uint32_t years, uint32_t months, uint32_t days, uint32_t hours,
85
                                uint32_t minutes, uint32_t seconds, uint32_t nanoseconds);
1377.8.6 by Paweł Blokus
added tests for Date operators used for comparing with timestamps
86
  };
1377.8.23 by Paweł Blokus
added generator for TemporalFormat
87
88
  class TemporalFormatGen
89
  {
90
  public:
91
    static drizzled::TemporalFormat *make_temporal_format(const char *regexp,
92
                                     int32_t year_part_index,
93
                                     int32_t month_part_index,
94
                                     int32_t day_part_index,
95
                                     int32_t hour_part_index,
96
                                     int32_t minute_part_index,
97
                                     int32_t second_part_index,
98
                                     int32_t usecond_part_index,
99
                                     int32_t nsecond_part_index);
100
  };
1377.8.32 by Paweł Blokus
setters to TemporalInterval
101
102
  class TemporalIntervalGen
103
  {
104
  public:
105
    static drizzled::TemporalInterval *make_temporal_interval(
106
                                                              uint32_t  year,
107
                                                              uint32_t  month,
108
                                                              uint32_t  day,
109
                                                              uint32_t  hour,
110
                                                              uint64_t  minute,
111
                                                              uint64_t  second,
112
                                                              uint64_t  second_part,
113
                                                              bool neg);
114
  };
1377.8.2 by Paweł Blokus
created files for temporal tests
115
};
116
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
117
#endif /*UNITTESTS_GENERATOR_H*/