Compare commits
10 Commits
arabic-lot
...
testing
Author | SHA1 | Date | |
---|---|---|---|
e08e6c6821 | |||
f9db50919f | |||
617d293358 | |||
aa6a489f34 | |||
c25f650755 | |||
2ab696906c | |||
61de67efa4 | |||
e44480cb21 | |||
b6d8ca18c9 | |||
132a7aaac3 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -57,8 +57,8 @@ Makefile.in
|
||||
/tests/*-test
|
||||
/tests/*-test.log
|
||||
/tests/*-test.trs
|
||||
/tests/test-suite.log
|
||||
/swe-glib-lcov*
|
||||
test-suite.log
|
||||
*.gcno
|
||||
*.gcda
|
||||
*.gcov
|
||||
|
@@ -7,11 +7,13 @@ addons:
|
||||
- gobject-introspection
|
||||
- gnome-common
|
||||
- autopoint
|
||||
before_script: ./autogen.sh
|
||||
- lcov
|
||||
before_script: ./autogen.sh --enable-coverage
|
||||
script:
|
||||
- make
|
||||
- make check
|
||||
before_install:
|
||||
- pip install --user codecov
|
||||
after_success:
|
||||
- codecov
|
||||
- find -type f -name '*.gcno'
|
||||
- codecov --gcov-root src
|
||||
|
@@ -107,7 +107,7 @@ AS_IF([ test "x$use_gcov" = "xyes"], [
|
||||
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
|
||||
|
||||
AS_IF([ test "$LTP" ], [
|
||||
AC_CACHE_CHECK([for ltp version], sw_glib_cv_ltp_version, [
|
||||
AC_CACHE_CHECK([for ltp version], swe_glib_cv_ltp_version, [
|
||||
swe_glib_cv_ltp_version=invalid
|
||||
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
|
||||
for ltp_check_version in $ltp_version_list; do
|
||||
|
312
data/lots.py
312
data/lots.py
@@ -1,312 +0,0 @@
|
||||
# -*- coding: utf8
|
||||
|
||||
import re
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
def get_planet_name(planet):
|
||||
if planet == 'ASC':
|
||||
return 'ASCENDANT'
|
||||
|
||||
if planet == 'S. Node':
|
||||
return 'MOON_SOUTH_NODE'
|
||||
|
||||
if planet.upper() in known_planets:
|
||||
return planet.upper()
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def get_planet_def(planet):
|
||||
PLANET_NAME = 0
|
||||
CUSP = 1
|
||||
RULER = 2
|
||||
SIGN = 3
|
||||
SIGN_DEGREE = 4
|
||||
SIGN_MINUTE = 5
|
||||
HOUSE_RULER = 6
|
||||
ARABIC_LOT = 7
|
||||
PLANET_HOUSE_RULER = 8
|
||||
|
||||
planet_def = [
|
||||
get_planet_name(planet), # 0, PLANET_NAME
|
||||
0, # 1, CUSP
|
||||
None, # 2, RULER
|
||||
None, # 3, SIGN
|
||||
0, # 4, SIGN_DEGREE
|
||||
0, # 5, SIGN_MINUTE
|
||||
0, # 6, HOUSE_RULER
|
||||
None, # 7, ARABIC_LOT
|
||||
None, # 8, PLANET_HOUSE_RULER
|
||||
]
|
||||
|
||||
sign_match = re.match(r'^(\d{2})([A-Z]{2})(\d{2})$', planet)
|
||||
|
||||
if planet_def[PLANET_NAME] is None:
|
||||
if planet.startswith('Ruler of ') and \
|
||||
get_planet_name(planet[9:]) is not None:
|
||||
planet_def[RULER] = get_planet_name(planet[9:])
|
||||
elif planet.startswith('Ruler '):
|
||||
m1 = re.match(r'Ruler (\d+)(st|nd|rd|th)', planet)
|
||||
m2 = re.match(r"Ruler (\w+)'s house", planet)
|
||||
|
||||
if m1 is not None:
|
||||
planet_def[HOUSE_RULER] = int(m1.groups()[0])
|
||||
|
||||
elif m2 is not None:
|
||||
planet_def[PLANET_HOUSE_RULER] = get_planet_name(
|
||||
m2.groups()[0])
|
||||
|
||||
if planet_def[PLANET_HOUSE_RULER] is None:
|
||||
logging.error(
|
||||
"Error: planet house ruler definition error: {}"
|
||||
.format(planet))
|
||||
|
||||
return None
|
||||
else:
|
||||
logging.error(
|
||||
"Error: House ruler definition problem: {}"
|
||||
.format(planet))
|
||||
|
||||
return None
|
||||
elif planet.startswith('Cusp '):
|
||||
m = re.match(r'^Cusp (\d+)(st|nd|rd|th)', planet)
|
||||
|
||||
if m is None:
|
||||
logging.error("Cusp definition problem: {}"
|
||||
.format(planet))
|
||||
|
||||
return None
|
||||
|
||||
planet_def[CUSP] = int(m.groups()[0])
|
||||
elif sign_match is not None:
|
||||
degree, sign, minute = sign_match.groups()
|
||||
|
||||
planet_def[SIGN] = next(s for s in signs if s.startswith(sign))
|
||||
planet_def[SIGN_DEGREE] = int(degree)
|
||||
planet_def[SIGN_MINUTE] = int(minute)
|
||||
elif planet.startswith('PO '):
|
||||
p_lot = planet[3:]
|
||||
|
||||
if not any(x['c_name'] for y, x in lots.items()
|
||||
if p_lot.upper() == x['c_name']):
|
||||
logging.error("Error: Unknown lot: {}".format(planet))
|
||||
|
||||
return None
|
||||
|
||||
planet_def[ARABIC_LOT] = p_lot.upper()
|
||||
else:
|
||||
logging.error("Unknown planet definition: {}".format(planet))
|
||||
|
||||
return None
|
||||
|
||||
planet_def = map(lambda x: 'NONE' if x is None else x, planet_def)
|
||||
|
||||
return """
|
||||
{{
|
||||
GSWE_PLANET_{name},
|
||||
{cusp},
|
||||
GSWE_PLANET_{ruler},
|
||||
GSWE_SIGN_{sign}, {sign_degree}, {sign_minute},
|
||||
{house_ruler},
|
||||
GSWE_ARABIC_LOT_{arabic_lot},
|
||||
GSWE_PLANET_{planet_house_ruler}
|
||||
}}""".format(
|
||||
name=planet_def[PLANET_NAME],
|
||||
cusp=planet_def[CUSP],
|
||||
ruler=planet_def[RULER],
|
||||
sign=planet_def[SIGN],
|
||||
sign_degree=planet_def[SIGN_DEGREE],
|
||||
sign_minute=planet_def[SIGN_MINUTE],
|
||||
house_ruler=planet_def[HOUSE_RULER],
|
||||
arabic_lot=planet_def[ARABIC_LOT],
|
||||
planet_house_ruler=planet_def[PLANET_HOUSE_RULER],
|
||||
)
|
||||
|
||||
with open('lots.txt', 'r') as f:
|
||||
content = map(lambda line: line.strip(), f.readlines())
|
||||
|
||||
lots = OrderedDict()
|
||||
c_names = set()
|
||||
known_planets = [
|
||||
'MC',
|
||||
'VERTEX',
|
||||
'MOON_NODE',
|
||||
'MOON_APOGEE',
|
||||
'SUN',
|
||||
'MOON',
|
||||
'MERCURY',
|
||||
'VENUS',
|
||||
'EARTH',
|
||||
'MARS',
|
||||
'JUPITER',
|
||||
'SATURN',
|
||||
'URANUS',
|
||||
'NEPTUNE',
|
||||
'PLUTO',
|
||||
'CHIRON',
|
||||
'CERES',
|
||||
'PALLAS',
|
||||
'JUNO',
|
||||
'VESTA',
|
||||
'PHOLUS',
|
||||
'NESSUS',
|
||||
'CHARIKLO',
|
||||
'SEDNA',
|
||||
'ERIS',
|
||||
'DEJANIRA',
|
||||
'CIRCE',
|
||||
'ORCUS',
|
||||
'ASBOLUS',
|
||||
'HYGIEA',
|
||||
]
|
||||
signs = [
|
||||
'ARIES',
|
||||
'TAURUS',
|
||||
'GEMINI',
|
||||
'CANCER',
|
||||
'LEO',
|
||||
'VIRGO',
|
||||
'LIBRA',
|
||||
'SCORPIO',
|
||||
'SAGITTARIUS',
|
||||
'CAPRICORN',
|
||||
'AQUARIUS',
|
||||
'PISCES',
|
||||
]
|
||||
|
||||
while content:
|
||||
line = content.pop(0)
|
||||
|
||||
m = re.match('^([^=]+) = (.*)$', line)
|
||||
|
||||
if not m:
|
||||
print("Error in line (no lot name): {}".format(line))
|
||||
|
||||
continue
|
||||
|
||||
lot_name, line = m.groups()
|
||||
|
||||
line = line.strip()
|
||||
am_pm_rule = False
|
||||
|
||||
if re.search('AM.*::.*PM', line):
|
||||
am_pm_rule = True
|
||||
line = line.split(' :: ')[0]
|
||||
s = re.search(' \([AP]M\)$', line)
|
||||
if s is None:
|
||||
print("Error in AM/PM line: {}".format(line))
|
||||
|
||||
continue
|
||||
|
||||
line = line[:-5]
|
||||
|
||||
m = re.match('^([^-+]+) ([+-]) ([^-+]+) ([+-]) ([^-+]+)$', line)
|
||||
|
||||
if not m:
|
||||
print("Error in line (doesn't match): {}".format(line))
|
||||
continue
|
||||
|
||||
m = m.groups()
|
||||
|
||||
if m[1] != '+' and m[3] != '-':
|
||||
print("Error in line: {}".format(line))
|
||||
|
||||
continue
|
||||
|
||||
if lot_name in lots and not am_pm_rule:
|
||||
print("Lot {} already exists!".format(lot_name))
|
||||
|
||||
continue
|
||||
|
||||
lot_name_def = re.sub(r'[^A-Z0-9_]', '',
|
||||
re.sub(r'[ ,]+', '_', lot_name.upper()))
|
||||
|
||||
if lot_name_def in c_names:
|
||||
print("Lot {} already exists in enum!".format(lot_name_def))
|
||||
|
||||
lots[lot_name] = {
|
||||
"c_name": lot_name_def,
|
||||
"planets": (m[0], m[2], m[4]),
|
||||
"am_pm": am_pm_rule,
|
||||
}
|
||||
|
||||
enum = '''typedef enum _GsweArabicLot {
|
||||
GSWE_ARABIC_LOT_NONE,\n'''
|
||||
|
||||
defs = '''typedef struct _GsweArabicLotPart {
|
||||
GswePlanet planet;
|
||||
guint8 cusp;
|
||||
GswePlanet ruler;
|
||||
GsweZodiac fixed_sign;
|
||||
guint8 fixed_degree;
|
||||
guint8 fixed_minute;
|
||||
guint8 house_ruler;
|
||||
GsweArabicLot arabic_lot;
|
||||
GswePlanet planet_house_ruler;
|
||||
} GsweArabicLotPart;
|
||||
|
||||
typedef struct _GsweArabicLotRecord {
|
||||
gchar *name;
|
||||
gboolean am_pm_rule;
|
||||
|
||||
GsweArabicLotPart parts[3];
|
||||
} GsweArabicLotRecord;
|
||||
|
||||
static const GsweArabicLotRecord known_lots[] = {
|
||||
'''
|
||||
|
||||
for idx, (lot_name, lot) in enumerate(lots.items()):
|
||||
if idx != 0:
|
||||
enum += ',\n'
|
||||
defs += '\n'
|
||||
|
||||
enum += ' GSWE_ARABIC_LOT_' + lot['c_name']
|
||||
|
||||
defs += ' // Record for enum value ' + lot['c_name'] + '''
|
||||
{
|
||||
"''' + lot_name + '''",
|
||||
''' + ("TRUE" if lot['am_pm'] else "FALSE") + ''',
|
||||
{'''
|
||||
|
||||
for pidx, planet in enumerate(lot['planets']):
|
||||
defs += get_planet_def(planet)
|
||||
|
||||
if pidx != 2:
|
||||
defs += ','
|
||||
|
||||
defs += '''\n }
|
||||
},\n'''
|
||||
|
||||
defs += ''' {NULL}
|
||||
};'''
|
||||
|
||||
enum += '\n} GsweArabicLot;'
|
||||
|
||||
print("""/* gswe-lots.h - Arabic lot definitions for SWE-GLib
|
||||
*
|
||||
* Copyright © 2013 Gergely Polonkai
|
||||
*
|
||||
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SWE-GLib is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __GSWE_LOTS_H__
|
||||
#define __GSWE_LOTS_H__
|
||||
|
||||
#include "gswe-types.h"
|
||||
""" + enum + """
|
||||
|
||||
""" + defs + """
|
||||
|
||||
#endif /* __GSWE_LOTS_H__ */""")
|
109
data/lots.txt
109
data/lots.txt
@@ -1,109 +0,0 @@
|
||||
Fortune = ASC + Moon - Sun (AM) :: ASC + Sun - Moon (PM)
|
||||
Ability = ASC + Mars - Ruler of ASC
|
||||
Abundance = ASC + Sun - Moon
|
||||
Accident = ASC + Saturn - Mars
|
||||
Accomplishment = ASC + Sun - Jupiter
|
||||
Action/Reasoning = ASC + Mars - Mercury
|
||||
Addiction = ASC + S. Node - Neptune
|
||||
Administrators = ASC + Mars - Mercury
|
||||
Agriculture = ASC + Saturn - Venus
|
||||
Allegiance = ASC + Saturn - Sun
|
||||
Ancestors/Relations = ASC + Mars - Saturn (AM) :: ASC + Saturn - Mars (PM)
|
||||
Ancestral Heritage = ASC + Moon - Cusp 8th
|
||||
Armies = ASC + Saturn - Mars
|
||||
Art = ASC + Venus - Mercury
|
||||
Assassination (1) = ASC + Ruler 12th - Neptune
|
||||
Assassination (2) = Mars + Neptune - Uranus
|
||||
Assurance = ASC + Jupiter - Mercury
|
||||
Astrology = ASC + Uranus - Mercury
|
||||
Bad Luck = ASC + PO Fortune - PO Spirit
|
||||
Bankruptcy (1) = Jupiter + Neptune - Uranus
|
||||
Bankruptcy (2) = Jupiter + Jupiter - Uranus
|
||||
Beauty = ASC + Venus - Sun
|
||||
Benific Change = ASC + Pluto - Jupiter
|
||||
Benevolence = ASC + Jupiter - Pluto
|
||||
Business Partnerships = ASC + Cusp 7th - Ruler 10th
|
||||
Cancer = ASC + Neptune - Jupiter
|
||||
Catastrophe (1) = ASC + Uranus - Sun
|
||||
Catastrophe (2) = ASC + Uranus - Saturn
|
||||
Caution = ASC + Neptune - Saturn
|
||||
Children = ASC + Saturn - Jupiter (AM) :: ASC + Jupiter - Saturn (PM)
|
||||
Commerce (1) = ASC + Mercury - Sun
|
||||
Commerce (2) = ASC + Mars - Sun
|
||||
Controversy = ASC + Jupiter - Mars
|
||||
Corruptness = ASC + Neptune - Venus
|
||||
Curiosity = ASC + Moon - Mercury
|
||||
Damage = ASC + Neptune - Venus
|
||||
Danger, Violence, Debt = ASC + Mercury - Saturn (AM) :: ASC + Saturn - Mercury (PM)
|
||||
Daughters = ASC + Venus - Moon
|
||||
Death = ASC + Cusp 8th - Moon
|
||||
Death (Parents) = ASC + Jupiter - Saturn (AM) :: ASC + Saturn - Jupiter (PM)
|
||||
Debt = ASC + Mercury - Saturn (AM) :: ASC + Saturn - Mercury (PM)
|
||||
Desire, Sexual Attraction = ASC + Cusp 5th + Ruler 5th
|
||||
Destiny = MC + Sun - Moon (AM) :: MC + Mooon - Sun (PM)
|
||||
Destruction = ASC + Mars - Sun
|
||||
Disease = ASC + Mars - Mercury
|
||||
Divorce (1) = ASC + Venus - Cusp 7th
|
||||
Divorce (2) = ASC + Cusp 7th - Saturn
|
||||
Eccentricity = ASC + Mercury - Uranus
|
||||
Energy, Sex Drive = ASC + Pluto - Venus
|
||||
Expected Birth (1) = ASC + Ruler Moon's house - Moon
|
||||
Expected Birth (2) = ASC + Venus - Moon
|
||||
Fame = ASC + Jupiter - Sun (AM) :: ASC + Sun - Jupiter (PM)
|
||||
Famous Friends = ASC + PO Fortune - Sun
|
||||
Fascination = ASC + Venus - Uranus
|
||||
Fate (Karma) = ASC + Saturn - Sun
|
||||
Father = ASC + Sun - Saturn (AM) :: ASC + Saturn - Sun (PM)
|
||||
Fraud = ASC + Neptune - Sun
|
||||
Friends (1) = ASC + Moon - Venus
|
||||
Friends (2) = ASC + Mercury - Moon
|
||||
Friends (3) = ASC + Moon - Uranus
|
||||
Genius = ASC + Sun - Neptune
|
||||
Grandparents (1) = ASC + Jupiter - Cusp 2nd (AM) :: ASC + Cusp 2nd - Jupiter (PM)
|
||||
Grandparents (2) = ASC + Saturn - Cusp 2nd (AM) :: ASC + Cusp 2nd - Saturn (PM)
|
||||
Guidance = ASC + Neptune - Uranus
|
||||
Happiness = ASC + Uranus - Jupiter
|
||||
Homosexuality = ASC + Mars - Uranus
|
||||
Horsemanship = ASC + Moon - Saturn
|
||||
Identity = ASC + Saturn - Moon
|
||||
Imprisonment = ASC + Sun - Neptune
|
||||
Increase = ASC + Jupiter - Sun
|
||||
Inheritance (1) = ASC + Moon - Saturn
|
||||
Inheritance (2) = ASC + Jupiter - Venus
|
||||
Journeys (Air) = ASC + Uranus - Cusp 9th
|
||||
Journeys (Land) = ASC + Cusp 9th - Ruler 9th
|
||||
Journeys (Water) = ASC + 15CA00 + Saturn (AM) :: ASC + Saturn - 15CA00 (PM)
|
||||
Kings, Rulers = ASC + Moon - Mercury
|
||||
Knowledge = ASC + Moon - Mercury (AM) :: ASC + Mercury - Moon (PM)
|
||||
Life, Reincarnation = ASC + Saturn - Jupiter (AM) :: ASC + Jupiter - Saturn (PM)
|
||||
Love = ASC + Venus - Sun
|
||||
Lovers = Mars + Venus - Cusp 5th
|
||||
Luck = ASC + Moon - Jupiter
|
||||
Marriage = ASC + Cusp 7th - Venus
|
||||
Marriage of Woman (1) = ASC + Saturn - Venus
|
||||
Marriage of Woman (2) = ASC + Mars - Moon
|
||||
Marriage of Man (1) = ASC + Venus - Saturn
|
||||
Marriage of Man (2) = ASC + Venus - Sun
|
||||
Mother = ASC + Moon - Saturn
|
||||
Partners = ASC + Cusp 7th - Venus
|
||||
Peril = ASC + Cusp 8th - Saturn (AM) :: ASC + Saturn - Cusp 8th (PM)
|
||||
Possessions = ASC + Cusp 2nd - Ruler 2nd
|
||||
Real Estate (Land) = ASC + Moon - Saturn (AM) :: ASC + Saturn - Moon (PM)
|
||||
Real Estate (Investment) = ASC + Jupiter - Mercury (AM) :: ASC + Mercury - Jupiter (PM)
|
||||
Secret Enemies = ASC + Moon - Saturn
|
||||
Short Journeys = ASC + Cusp 3rd - Ruler 3rd
|
||||
Siblings = ASC + Saturn - Jupiter
|
||||
Sickness = ASC + Mars - Saturn
|
||||
Son-in-Laws = ASC + Venus - Saturn (AM) :: ASC + Saturn - Venus (PM)
|
||||
Sons = Cusp 4th + Moon - Sun
|
||||
Spirit = ASC + Sun - Moon (AM) :: ASC + Moon - Sun (PM)
|
||||
Success = ASC + Jupiter - PO Fortune (AM) :: ASC + PO Fortune - Jupiter (PM)
|
||||
Success (Investment) = ASC + Venus - Saturn
|
||||
Suicide (1) = ASC + Cusp 8th - Neptune
|
||||
Suicide (2) = ASC + Jupiter - Neptune
|
||||
Surgery = ASC + Saturn - Mars (AM) :: ASC + Mars - Saturn (PM)
|
||||
Tragedy = ASC + Saturn - Sun
|
||||
Unusual Events = ASC + Uranus - Moon
|
||||
Victory = ASC + Jupiter - PO Spirit (AM) :: ASC + PO Spirit - Jupiter (PM)
|
||||
Weddings, Legal Contracts = Cusp 9th + Cusp 3rd - Venus
|
||||
Widowhood = ASC + 08LI50 - Neptune
|
@@ -25,7 +25,6 @@ INST_H_SRC_FILES = \
|
||||
|
||||
INST_H_BUILT_FILES = \
|
||||
gswe-enumtypes.h \
|
||||
gswe-lots.h \
|
||||
gswe-version.h \
|
||||
$(NULL)
|
||||
|
||||
@@ -62,7 +61,6 @@ libswe_glib_2_0_la_SOURCES = \
|
||||
gswe-timestamp.c \
|
||||
gswe-enumtypes.c \
|
||||
gswe-version.c \
|
||||
gswe-lots.c \
|
||||
$(NULL)
|
||||
|
||||
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
|
||||
|
3862
src/gswe-lots.c
3862
src/gswe-lots.c
File diff suppressed because it is too large
Load Diff
136
src/gswe-lots.h
136
src/gswe-lots.h
@@ -1,136 +0,0 @@
|
||||
/* gswe-lots.h - Arabic lot definitions for SWE-GLib
|
||||
*
|
||||
* Copyright © 2013 Gergely Polonkai
|
||||
*
|
||||
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SWE-GLib is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __GSWE_LOTS_H__
|
||||
#define __GSWE_LOTS_H__
|
||||
|
||||
#include "gswe-types.h"
|
||||
|
||||
typedef enum _GsweArabicLot {
|
||||
GSWE_ARABIC_LOT_NONE,
|
||||
GSWE_ARABIC_LOT_FORTUNE,
|
||||
GSWE_ARABIC_LOT_ABILITY,
|
||||
GSWE_ARABIC_LOT_ABUNDANCE,
|
||||
GSWE_ARABIC_LOT_ACCIDENT,
|
||||
GSWE_ARABIC_LOT_ACCOMPLISHMENT,
|
||||
GSWE_ARABIC_LOT_ACTIONREASONING,
|
||||
GSWE_ARABIC_LOT_ADDICTION,
|
||||
GSWE_ARABIC_LOT_ADMINISTRATORS,
|
||||
GSWE_ARABIC_LOT_AGRICULTURE,
|
||||
GSWE_ARABIC_LOT_ALLEGIANCE,
|
||||
GSWE_ARABIC_LOT_ANCESTORSRELATIONS,
|
||||
GSWE_ARABIC_LOT_ANCESTRAL_HERITAGE,
|
||||
GSWE_ARABIC_LOT_ARMIES,
|
||||
GSWE_ARABIC_LOT_ART,
|
||||
GSWE_ARABIC_LOT_ASSASSINATION_1,
|
||||
GSWE_ARABIC_LOT_ASSASSINATION_2,
|
||||
GSWE_ARABIC_LOT_ASSURANCE,
|
||||
GSWE_ARABIC_LOT_ASTROLOGY,
|
||||
GSWE_ARABIC_LOT_BAD_LUCK,
|
||||
GSWE_ARABIC_LOT_BANKRUPTCY_1,
|
||||
GSWE_ARABIC_LOT_BANKRUPTCY_2,
|
||||
GSWE_ARABIC_LOT_BEAUTY,
|
||||
GSWE_ARABIC_LOT_BENIFIC_CHANGE,
|
||||
GSWE_ARABIC_LOT_BENEVOLENCE,
|
||||
GSWE_ARABIC_LOT_BUSINESS_PARTNERSHIPS,
|
||||
GSWE_ARABIC_LOT_CANCER,
|
||||
GSWE_ARABIC_LOT_CATASTROPHE_1,
|
||||
GSWE_ARABIC_LOT_CATASTROPHE_2,
|
||||
GSWE_ARABIC_LOT_CAUTION,
|
||||
GSWE_ARABIC_LOT_CHILDREN,
|
||||
GSWE_ARABIC_LOT_COMMERCE_1,
|
||||
GSWE_ARABIC_LOT_COMMERCE_2,
|
||||
GSWE_ARABIC_LOT_CONTROVERSY,
|
||||
GSWE_ARABIC_LOT_CORRUPTNESS,
|
||||
GSWE_ARABIC_LOT_CURIOSITY,
|
||||
GSWE_ARABIC_LOT_DAMAGE,
|
||||
GSWE_ARABIC_LOT_DANGER_VIOLENCE_DEBT,
|
||||
GSWE_ARABIC_LOT_DAUGHTERS,
|
||||
GSWE_ARABIC_LOT_DEATH,
|
||||
GSWE_ARABIC_LOT_DEATH_PARENTS,
|
||||
GSWE_ARABIC_LOT_DEBT,
|
||||
GSWE_ARABIC_LOT_DESIRE_SEXUAL_ATTRACTION,
|
||||
GSWE_ARABIC_LOT_DESTINY,
|
||||
GSWE_ARABIC_LOT_DESTRUCTION,
|
||||
GSWE_ARABIC_LOT_DISEASE,
|
||||
GSWE_ARABIC_LOT_DIVORCE_1,
|
||||
GSWE_ARABIC_LOT_DIVORCE_2,
|
||||
GSWE_ARABIC_LOT_ECCENTRICITY,
|
||||
GSWE_ARABIC_LOT_ENERGY_SEX_DRIVE,
|
||||
GSWE_ARABIC_LOT_EXPECTED_BIRTH_1,
|
||||
GSWE_ARABIC_LOT_EXPECTED_BIRTH_2,
|
||||
GSWE_ARABIC_LOT_FAME,
|
||||
GSWE_ARABIC_LOT_FAMOUS_FRIENDS,
|
||||
GSWE_ARABIC_LOT_FASCINATION,
|
||||
GSWE_ARABIC_LOT_FATE_KARMA,
|
||||
GSWE_ARABIC_LOT_FATHER,
|
||||
GSWE_ARABIC_LOT_FRAUD,
|
||||
GSWE_ARABIC_LOT_FRIENDS_1,
|
||||
GSWE_ARABIC_LOT_FRIENDS_2,
|
||||
GSWE_ARABIC_LOT_FRIENDS_3,
|
||||
GSWE_ARABIC_LOT_GENIUS,
|
||||
GSWE_ARABIC_LOT_GRANDPARENTS_1,
|
||||
GSWE_ARABIC_LOT_GRANDPARENTS_2,
|
||||
GSWE_ARABIC_LOT_GUIDANCE,
|
||||
GSWE_ARABIC_LOT_HAPPINESS,
|
||||
GSWE_ARABIC_LOT_HOMOSEXUALITY,
|
||||
GSWE_ARABIC_LOT_HORSEMANSHIP,
|
||||
GSWE_ARABIC_LOT_IDENTITY,
|
||||
GSWE_ARABIC_LOT_IMPRISONMENT,
|
||||
GSWE_ARABIC_LOT_INCREASE,
|
||||
GSWE_ARABIC_LOT_INHERITANCE_1,
|
||||
GSWE_ARABIC_LOT_INHERITANCE_2,
|
||||
GSWE_ARABIC_LOT_JOURNEYS_AIR,
|
||||
GSWE_ARABIC_LOT_JOURNEYS_LAND,
|
||||
GSWE_ARABIC_LOT_JOURNEYS_WATER,
|
||||
GSWE_ARABIC_LOT_KINGS_RULERS,
|
||||
GSWE_ARABIC_LOT_KNOWLEDGE,
|
||||
GSWE_ARABIC_LOT_LIFE_REINCARNATION,
|
||||
GSWE_ARABIC_LOT_LOVE,
|
||||
GSWE_ARABIC_LOT_LOVERS,
|
||||
GSWE_ARABIC_LOT_LUCK,
|
||||
GSWE_ARABIC_LOT_MARRIAGE,
|
||||
GSWE_ARABIC_LOT_MARRIAGE_OF_WOMAN_1,
|
||||
GSWE_ARABIC_LOT_MARRIAGE_OF_WOMAN_2,
|
||||
GSWE_ARABIC_LOT_MARRIAGE_OF_MAN_1,
|
||||
GSWE_ARABIC_LOT_MARRIAGE_OF_MAN_2,
|
||||
GSWE_ARABIC_LOT_MOTHER,
|
||||
GSWE_ARABIC_LOT_PARTNERS,
|
||||
GSWE_ARABIC_LOT_PERIL,
|
||||
GSWE_ARABIC_LOT_POSSESSIONS,
|
||||
GSWE_ARABIC_LOT_REAL_ESTATE_LAND,
|
||||
GSWE_ARABIC_LOT_REAL_ESTATE_INVESTMENT,
|
||||
GSWE_ARABIC_LOT_SECRET_ENEMIES,
|
||||
GSWE_ARABIC_LOT_SHORT_JOURNEYS,
|
||||
GSWE_ARABIC_LOT_SIBLINGS,
|
||||
GSWE_ARABIC_LOT_SICKNESS,
|
||||
GSWE_ARABIC_LOT_SONINLAWS,
|
||||
GSWE_ARABIC_LOT_SONS,
|
||||
GSWE_ARABIC_LOT_SPIRIT,
|
||||
GSWE_ARABIC_LOT_SUCCESS,
|
||||
GSWE_ARABIC_LOT_SUCCESS_INVESTMENT,
|
||||
GSWE_ARABIC_LOT_SUICIDE_1,
|
||||
GSWE_ARABIC_LOT_SUICIDE_2,
|
||||
GSWE_ARABIC_LOT_SURGERY,
|
||||
GSWE_ARABIC_LOT_TRAGEDY,
|
||||
GSWE_ARABIC_LOT_UNUSUAL_EVENTS,
|
||||
GSWE_ARABIC_LOT_VICTORY,
|
||||
GSWE_ARABIC_LOT_WEDDINGS_LEGAL_CONTRACTS,
|
||||
GSWE_ARABIC_LOT_WIDOWHOOD
|
||||
} GsweArabicLot;
|
||||
|
||||
#endif /* __GSWE_LOTS_H__ */
|
@@ -488,10 +488,13 @@ gswe_timestamp_set_property(GObject *object,
|
||||
|
||||
break;
|
||||
|
||||
/* LCOV_EXCL_START Unless a property ID is missing from above,
|
||||
* we will never arrive here */
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
|
||||
break;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,10 +588,13 @@ gswe_timestamp_get_property(
|
||||
|
||||
break;
|
||||
|
||||
/* LCOV_EXCL_START Unless a property ID is missing from above,
|
||||
* we will never arrive here */
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
|
||||
break;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include "gswe-timestamp.h"
|
||||
#include "gswe-moment.h"
|
||||
#include "gswe-enumtypes.h"
|
||||
#include "gswe-lots.h"
|
||||
|
||||
typedef enum {
|
||||
GSWE_ERROR_SUCCESS,
|
||||
|
55
swe-glib.mk
55
swe-glib.mk
@@ -1,4 +1,7 @@
|
||||
# SWE-GLib - GLib wrapper around the Swiss Ephemeris library
|
||||
#
|
||||
# Most of this file is got from GLib, especially the code coverage measurement
|
||||
# parts
|
||||
|
||||
GTESTER = gtester
|
||||
GTESTER_REPORT = gtester-report
|
||||
@@ -7,7 +10,7 @@ NULL =
|
||||
# initialize variables for unconditional += appending
|
||||
BUILT_SOURCES =
|
||||
BUILT_EXTRA_DIST =
|
||||
CLEANFILES = *.log *.trs
|
||||
CLEANFILES = *.log *.trs *.gcda
|
||||
DISTCLEANFILES =
|
||||
MAINTAINERCLEANFILES =
|
||||
EXTRA_DIST =
|
||||
@@ -33,9 +36,7 @@ else
|
||||
test-nonrecursive:
|
||||
endif
|
||||
|
||||
.PHONY: test-nonrecursive
|
||||
|
||||
.PHONY: lcov genlcov lcov-clean
|
||||
.PHONY: test-nonrecursive lcov genlcov lcov-clean
|
||||
# use recursive makes in order to ignore errors during check
|
||||
lcov:
|
||||
-$(MAKE) $(AM_MAKEFLAGS) -k check
|
||||
@@ -45,9 +46,8 @@ lcov:
|
||||
# placing the objects files in the .libs/ directory separate from the *.c
|
||||
# we also have to delete tests/.libs/libmoduletestplugin_*.gcda
|
||||
genlcov:
|
||||
$(AM_V_GEN) rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda; \
|
||||
$(LTP) --quiet --directory $(top_builddir) --capture --output-file swe-glib-lcov.info --test-name SWE_GLIB_PERF --no-checksum --compat-libtool --ignore-errors source; \
|
||||
$(LTP) --quiet --output-file swe-glib-lcov.info --remove swe-glib-lcov.info docs/reference/\* /tmp/\* gio/tests/gdbus-object-manager-example/\* ; \
|
||||
$(AM_V_GEN) $(LTP) --quiet --directory $(top_builddir) --capture --output-file swe-glib-lcov.info --test-name SWE_GLIB_PERF --no-checksum --compat-libtool --ignore-errors source; \
|
||||
$(LTP) --quiet --output-file swe-glib-lcov.info --remove swe-glib-lcov.info docs/reference/\* /tmp/\* ; \
|
||||
LANG=C $(LTP_GENHTML) --quiet --prefix $(top_builddir) --output-directory swe-glib-lcov --title "SWE-GLib Code Coverage" --legend --frames --show-details swe-glib-lcov.info --ignore-errors source
|
||||
@echo "file://$(abs_top_builddir)/swe-glib-lcov/index.html"
|
||||
|
||||
@@ -59,47 +59,6 @@ lcov-clean:
|
||||
# run tests in cwd as part of make check
|
||||
check-local: test-nonrecursive
|
||||
|
||||
# We support a fairly large range of possible variables. It is expected that all types of files in a test suite
|
||||
# will belong in exactly one of the following variables.
|
||||
#
|
||||
# First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
|
||||
#
|
||||
# test_programs, test_scripts, test_data, test_ltlibraries
|
||||
#
|
||||
# The above are used to list files that are involved in both uninstalled and installed testing. The
|
||||
# test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
|
||||
# Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
|
||||
# installed in the same way as it appears in the package layout.
|
||||
#
|
||||
# In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
|
||||
# like so:
|
||||
#
|
||||
# installed_test_programs, uninstalled_test_programs
|
||||
# installed_test_scripts, uninstalled_test_scripts
|
||||
# installed_test_data, uninstalled_test_data
|
||||
# installed_test_ltlibraries, uninstalled_test_ltlibraries
|
||||
#
|
||||
# Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts
|
||||
# that should not themselves be run as testcases (but exist to be used from other testcases):
|
||||
#
|
||||
# test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
|
||||
# test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
|
||||
#
|
||||
# Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
|
||||
# file automatically end up in the tarball.
|
||||
#
|
||||
# dist_test_scripts, dist_test_data, dist_test_extra_scripts
|
||||
# dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
|
||||
# dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
|
||||
#
|
||||
# Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the
|
||||
# standard automake convention of not disting programs scripts or data by default.
|
||||
#
|
||||
# test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
|
||||
# variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under
|
||||
# gtester. That's a bit strange for scripts, but it's possible.
|
||||
|
||||
# we use test -z "$(TEST_PROGS)" above, so make sure we have no extra whitespace...
|
||||
TEST_PROGS += $(strip $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
|
||||
$(dist_test_scripts) $(dist_uninstalled_test_scripts))
|
||||
|
||||
|
@@ -26,6 +26,7 @@ static struct testdata_t td[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* Test Gregorian date values */
|
||||
static void
|
||||
test_timestamp_gregorian(void)
|
||||
{
|
||||
@@ -141,6 +142,7 @@ test_timestamp_gregorian(void)
|
||||
g_clear_object(×tamp);
|
||||
}
|
||||
|
||||
/* Check timezone mangling */
|
||||
static void
|
||||
test_timestamp_timezone(void)
|
||||
{
|
||||
@@ -191,6 +193,7 @@ test_timestamp_timezone(void)
|
||||
g_clear_object(×tamp);
|
||||
}
|
||||
|
||||
/* Test Julian Day (Ephemeris Time) properties */
|
||||
static void
|
||||
test_timestamp_jdet(void)
|
||||
{
|
||||
@@ -216,13 +219,26 @@ test_timestamp_jdet(void)
|
||||
g_assert_null(err);
|
||||
gswe_assert_fuzzy_equals(jdet, td[1].jdet, 0.000001);
|
||||
|
||||
/* Set via property */
|
||||
g_object_set(timestamp,
|
||||
"julian-day", td[0].jdet,
|
||||
NULL);
|
||||
jdet = gswe_timestamp_get_julian_day_et(timestamp, &err);
|
||||
gswe_assert_fuzzy_equals(jdet, td[0].jdet, 0.000001);
|
||||
g_object_get(timestamp,
|
||||
"julian-day", &jdet,
|
||||
NULL);
|
||||
gswe_assert_fuzzy_equals(jdet, td[0].jdet, 0.000001);
|
||||
|
||||
g_clear_object(×tamp);
|
||||
}
|
||||
|
||||
/* Test Julian Day (Universal Time) properties */
|
||||
static void
|
||||
test_timestamp_jdut(void)
|
||||
{}
|
||||
|
||||
/* Test instant-recalc property */
|
||||
static void
|
||||
test_timestamp_instant(void)
|
||||
{
|
||||
@@ -268,11 +284,12 @@ test_timestamp_instant(void)
|
||||
g_assert_false(jul_valid);
|
||||
}
|
||||
|
||||
/* Test Gregorian Date to Julian Day conversion */
|
||||
static void
|
||||
test_timestamp_conv_gregjd(void)
|
||||
{
|
||||
GsweTimestamp *timestamp;
|
||||
gdouble jdet;
|
||||
gdouble jdet, tz_jdet;
|
||||
GError *err = NULL;
|
||||
|
||||
/* Create timestamp from testdata */
|
||||
@@ -293,17 +310,68 @@ test_timestamp_conv_gregjd(void)
|
||||
0.0001
|
||||
);
|
||||
|
||||
/* Julian Day should not change if only the timezone changes */
|
||||
td[1].tz += 1.0;
|
||||
tz_jdet = gswe_timestamp_get_julian_day_ut(timestamp, &err);
|
||||
g_assert_cmpfloat(jdet, ==, tz_jdet);
|
||||
|
||||
g_clear_object(×tamp);
|
||||
}
|
||||
|
||||
/* Julian Day to Gregorian Date conversion */
|
||||
static void
|
||||
test_timestamp_conv_jdgreg(void)
|
||||
{}
|
||||
{
|
||||
GsweTimestamp *timestamp;
|
||||
guint year, month, day, hour, minute, second, ms;
|
||||
gdouble tz;
|
||||
gboolean gregorian_valid, julian_valid;
|
||||
GError *err = NULL;
|
||||
|
||||
timestamp = gswe_timestamp_new_from_julian_day(td[0].jdet);
|
||||
g_assert_nonnull(timestamp);
|
||||
g_object_get(timestamp,
|
||||
"gregorian-valid", &gregorian_valid,
|
||||
"julian-day-valid", &julian_valid,
|
||||
"gregorian-timezone-offset", &tz,
|
||||
NULL);
|
||||
g_assert_true(julian_valid);
|
||||
g_assert_cmpfloat(0.0, ==, tz);
|
||||
|
||||
gswe_timestamp_set_gregorian_timezone(timestamp, td[0].tz, &err);
|
||||
g_object_get(
|
||||
timestamp,
|
||||
"gregorian-year", &year,
|
||||
"gregorian-month", &month,
|
||||
"gregorian-day", &day,
|
||||
"gregorian-hour", &hour,
|
||||
"gregorian-minute", &minute,
|
||||
"gregorian-second", &second,
|
||||
"gregorian-microsecond", &ms,
|
||||
"gregorian-timezone-offset", &tz,
|
||||
NULL
|
||||
);
|
||||
g_assert_cmpint(year, ==, td[0].year);
|
||||
g_assert_cmpuint(month, ==, td[0].month);
|
||||
g_assert_cmpuint(day, ==, td[0].day);
|
||||
g_assert_cmpuint(hour, ==, td[0].hour);
|
||||
gswe_assert_fuzzy_equals(minute, td[0].minute, 1);
|
||||
|
||||
/* The following lines are commented out, as they will always fail
|
||||
* with the current precision of the test data.
|
||||
|
||||
g_assert_cmpuint(minute, ==, td[0].minute);
|
||||
g_assert_cmpuint(second, ==, td[0].second);
|
||||
g_assert_cmpuint(ms, ==, td[0].ms);
|
||||
*/
|
||||
g_assert_cmpfloat(tz, ==, td[0].tz); }
|
||||
|
||||
/* Sidereal time tests */
|
||||
static void
|
||||
test_timestamp_sidereal(void)
|
||||
{}
|
||||
|
||||
/* timestamp_now_* tests */
|
||||
static void
|
||||
test_timestamp_now(void)
|
||||
{}
|
||||
|
Reference in New Issue
Block a user