~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to unittests/temporal_generator.h

Merged Pawel from lp:~pblokus/drizzle/unittests-plugin-interfaces

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
24
#include "config.h"
 
25
 
 
26
namespace drizzled
 
27
{
 
28
  class Date;
 
29
  class TemporalFormat;
 
30
  class Temporal;
 
31
  class Time;
 
32
  class DateTime;
 
33
  class Timestamp;
 
34
  class MicroTimestamp;
 
35
  class NanoTimestamp;
 
36
}
 
37
 
 
38
class TemporalGenerator 
 
39
{
 
40
public:
 
41
 
 
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
  
 
51
  class DateGen
 
52
  {
 
53
  public:
 
54
    static void make_date(drizzled::Date *date, uint32_t years, uint32_t months, uint32_t days);
 
55
    static void make_valid_date(drizzled::Date *date);  
 
56
  };
 
57
  
 
58
  class TimeGen
 
59
  {
 
60
  public:
 
61
    static void make_time(drizzled::Time *time, uint32_t hours, uint32_t minutes, uint32_t seconds,
 
62
                          uint32_t useconds = 0);
 
63
  };
 
64
  
 
65
  class DateTimeGen
 
66
  {
 
67
  public:
 
68
    static void make_datetime(drizzled::DateTime *datetime,
 
69
                              uint32_t years, uint32_t months, uint32_t days, uint32_t hours,
 
70
                              uint32_t minutes, uint32_t seconds, uint32_t useconds = 0);
 
71
    static void make_valid_datetime(drizzled::DateTime *datetime);
 
72
  };
 
73
  
 
74
  class TimestampGen
 
75
  {
 
76
  public:
 
77
    static void make_timestamp(drizzled::Timestamp *timestamp,
 
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);
 
86
  };
 
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
  };
 
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
  };
 
115
};
 
116
 
 
117
#endif /*UNITTESTS_GENERATOR_H*/
 
 
b'\\ No newline at end of file'