diff --git a/rules/okom b/rules/okom/okom similarity index 50% rename from rules/okom rename to rules/okom/okom index 253a1abce..0a9cbe10e 100644 --- a/rules/okom +++ b/rules/okom/okom @@ -6,14 +6,35 @@ CONTEST=okom LOGFILE=okom.log CONTEST_MODE CABRILLO=UNIVERSAL -CABRILLO-CONTEST=OKOM +CABRILLO-CONTEST=OK-OM-DX + +#================================ +# Select one of following blocks: +#-------------------------------- +# +# non-OK/OM stations send serial number +# +CABRILLO-EXCHANGE=# +F3=@ ++5NN-- # +S&P_TU_MSG=TU ++5NN-- # +#-------------------------------- +# +# OK/OM stanice: okresní znak (tři písmena, XXX). # -MULT_LIST=okommults -COUNTRYLIST=OK,OM -COUNTRY_LIST_POINTS=1 -USE_COUNTRYLIST_ONLY -SERIAL_OR_SECTION -SECTION_MULT +##CABRILLO-EXCHANGE= XXX +##F3=@ ++5NN-- XXX +##S&P_TU_MSG=TU ++5NN-- XXX +#================================ + + +# Scoring: +# (handled by okom.py) + +# Multipliers: +# OK/OM districts and DXCC countries per band +# (handled by okom.py) +GENERIC_MULT=BAND + INITIAL_EXCHANGE=ok_om.txt RECALL_MULTS @@ -36,7 +57,7 @@ RECALL_MULTS # F1=+TEST -% %+TEST- F2=% -F3=+@ 5NN -# # +#F3=+@ 5NN -# # F4=TU 73 F5=@ F6=% @@ -48,5 +69,5 @@ F11=PSE K F12=+TEST -% %+ TEST- # CQ_TU_MSG=+TU -%+ TEST- -S&P_TU_MSG=+TU 5NN -# # +#S&P_TU_MSG=+TU 5NN -# # diff --git a/rules/okom/okom.py b/rules/okom/okom.py new file mode 100644 index 000000000..b9797f945 --- /dev/null +++ b/rules/okom/okom.py @@ -0,0 +1,106 @@ +""" +OK-OM DX Contest +http://okomdx.crk.cz/index.php?page=CW-rules-english +""" + +OKOM_DISTRICTS = { + 'OK': [ + # Praha + 'APA','APB','APC','APD','APE','APF','APG','APH','API','APJ', + # Central Bohemia + 'BBN','BBE','BKD','BKO','BKH','BME','BMB','BNY','BPZ','BPV','BPB','BRA', + # Southern Bohemia + 'CBU','CCK','CJH','CPE','CPI','CPR','CST','CTA', + # Western Bohemia + 'DDO','DCH','DKV','DKL','DPM','DPJ','DPS','DRO','DSO','DTA', + # Northern Bohemia + 'ECL','EDE','ECH','EJA','ELI','ELT','ELO','EMO','ETE','EUL', + # Eastern Bohemia + 'FHB','FHK','FCR','FJI','FNA','FPA','FRK','FSE','FSV','FTR','FUO', + # Southern Moravia + 'GBL','GBM','GBV','GBR','GHO','GJI','GKR','GPR','GTR','GUH','GVY','GZL','GZN', 'GZS', + # Northern Moravia + 'HBR','HFM','HJE','HKA','HNJ','HOL','HOP','HOS','HPR','HSU','HVS' + ], + 'OM': [ + # Bratislava, prefix OM1 + 'BAA','BAB','BAC','BAD','BAE','MAL','PEZ','SEN', + # Trnava, prefix OM2 + 'TRN','DST','GAL','HLO','PIE','SEA','SKA', + # Trencin, prefix OM4 + 'TNC','BAN','ILA','MYJ','NMV','PAR','PBY','PRI','PUC', + # Nitra, prefix OM5 + 'NIT','KOM','LVC','NZA','SAL','TOP','ZMO', + # Zilina, prefix OM6 + 'ZIL','BYT','CAD','DKU','KNM','LMI','MAR','NAM','RUZ','TTE','TVR', + # Banska Bystrica, prefix OM7 + 'BBY','BRE','DET','KRU','LUC','POL','REV','RSO','VKR','ZVO','ZAR','ZIH','BST', + # Kosice, prefix OM8 + 'KEA','KEB','KEC','KED','KEO','GEL','MIC','ROZ','SOB','SNV','TRE', + # Presov, prefix OM0 + 'PRE','BAR','HUM','KEZ','LEV','MED','POP','SAB','SNI','SLU','STR','SVI','VRT' + ] +} + +MY_PREFIX = None +MY_CONTINENT = None + +def init(cfg): + dxcc = tlf.get_dxcc(tlf.MY_CALL) + global MY_PREFIX + MY_PREFIX = dxcc.main_prefix + global MY_CONTINENT + MY_CONTINENT = dxcc.continent + + +def score(qso): + # 6.3 /MM stations are not multipliers, + # but worth 5 points for any participant. + if (qso.call.endswith('/MM')): + return 5 + + dxcc = tlf.get_dxcc(qso.call) + + if MY_PREFIX in ['OK','OM']: + # 6.1 Czech and Slovak station: + # - QSO with your own country - 2 points, + # - QSO with a different country on your continent - 3 points, + # - QSO with another continent - 5 points. + if dxcc.main_prefix == MY_PREFIX: + points = 2 + elif dxcc.continent == MY_CONTINENT: + points = 3 + else: + points = 5 + else: + # 6.2 Non-Czech and Slovak stations: + # - QSO with Czech and Slovak station - 10 points, + # - QSO with your own country - 1 points, + # - QSO with a different country on your continent - 3 points, + # - QSO with another continent - 5 points. + if dxcc.main_prefix in ['OK','OM']: + points = 10 + elif dxcc.main_prefix == MY_PREFIX: + points = 1 + elif dxcc.continent == MY_CONTINENT: + points = 3 + else: + points = 5 + + return points + + +def check_exchange(qso): + xchg = qso.exchange.strip() + dxcc = tlf.get_dxcc(qso.call) + + mult = dxcc.main_prefix + + if dxcc.main_prefix in ['OK','OM']: + if xchg in OKOM_DISTRICTS[dxcc.main_prefix]: + mult += ' ' + xchg + else: + xchg = xchg.rjust(3, '0') # normalize serial number + + return {'mult1_value': mult, 'normalized_exchange': xchg} + diff --git a/rules/spdx_dx b/rules/spdx_dx index 0f17bc47e..a4e1ccaf6 100644 --- a/rules/spdx_dx +++ b/rules/spdx_dx @@ -1,18 +1,20 @@ ######################################### # SPDX contest for stations outside SP # # PA0R, 3.10.2003 # +# https://spdxcontest.pzk.org.pl # ######################################### # CONTEST=spdx_dx LOGFILE=spdx.log CONTEST_MODE CABRILLO=UNIVERSAL +CABRILLO-CONTEST=SPDX ################################# MULT_LIST=spdxmults COUNTRYLIST=SP -USE_COUNTRYLIST_ONLY COUNTRY_LIST_POINTS=3 SECTION_MULT +SERIAL_OR_SECTION RECALL_MULTS SERIAL_EXCHANGE SHORT_SERIAL diff --git a/rules/spdx_sp b/rules/spdx_sp index 38247341d..0e325f850 100644 --- a/rules/spdx_sp +++ b/rules/spdx_sp @@ -1,18 +1,27 @@ ######################################### # SPDX contest for stations outside SP # # PA0R, 3.10.2003 # +# https://spdxcontest.pzk.org.pl # ######################################### # CONTEST=spdx_sp LOGFILE=spdx.log CONTEST_MODE CABRILLO=UNIVERSAL +CABRILLO-CONTEST=SPDX +# +# Zmień B na jednoliterowy skrót swojego województwa +# (patrz również poniżej F3 oraz S&P_TU_MSG) +# +CABRILLO-EXCHANGE=B +# ################################# MY_COUNTRY_POINTS=0 MY_CONTINENT_POINTS=1 DX_POINTS=3 COUNTRY_MULT -SERIAL_EXCHANGE +COUNTRYLIST=SP +EXCLUDE_MULTILIST=COUNTRYLIST NOB4 # ################################## diff --git a/share/okommults b/share/okommults deleted file mode 100644 index 1c4ad2bdd..000000000 --- a/share/okommults +++ /dev/null @@ -1,164 +0,0 @@ -APA -APB -APC -APD -APE -APF -APG -APH -API -APJ -BAA -BAB -BAC -BAD -BAE -BAN -BAR -BBE -BBN -BBY -BKD -BKH -BKO -BMB -BME -BNY -BPB -BPV -BPZ -BRA -BRE -BST -BYT -CAD -CBU -CCK -CJH -CPE -CPI -CPR -CTA -CST -DCH -DDO -DET -DKL -DKU -DKV -DPJ -DPM -DPS -DRO -DSO -DST -DTA -ECH -ECL -EDE -EJA -ELI -ELO -ELT -EMO -ETE -EUL -FCR -FHB -FHK -FJI -FNA -FPA -FRK -FSE -FSV -FTR -FUO -GAL -GBL -GBM -GBR -GBV -GEL -GHO -GJI -GKR -GPR -GTR -GUH -GVY -GZL -GZN -GZS -HBR -HFM -HJE -HKA -HLO -HNJ -HOL -HOP -HOS -HPR -HSU -HUM -HVS -ILA -KEA -KEB -KEC -KED -KEO -KEZ -KNM -KOM -KRU -LEV -LMI -LUC -LVC -MAL -MAR -MED -MIC -MYJ -NAM -NIT -NMV -NZA -PAR -PBY -PEZ -PIE -POL -POP -PRE -PRI -PUC -REV -ROZ -RSO -RUZ -SAB -SEA -SEN -SKA -SLU -SNI -SNV -SOB -STR -SVI -TNC -TOP -TRE -TRN -TTE -TVR -VKR -VRT -ZAR -ZIH -ZIL -ZMO -ZVO diff --git a/src/globalvars.h b/src/globalvars.h index d90681e57..c44419c3b 100644 --- a/src/globalvars.h +++ b/src/globalvars.h @@ -255,8 +255,6 @@ extern char fkey_header[60]; extern SCREEN *mainscreen; -extern bool mult_side; -extern bool countrylist_only; extern bool mixedmode; extern bool qso_once; extern bool leading_zeros_serial; diff --git a/src/main.c b/src/main.c index 5475a3b92..710092e6a 100644 --- a/src/main.c +++ b/src/main.c @@ -123,13 +123,11 @@ int my_country_points = -1; int my_cont_points = -1; int dx_cont_points = -1; char countrylist[255][6]; -bool countrylist_only = false; int countrylist_points = -1; char continent_multiplier_list[7][3]; // SA, NA, EU, AF, AS and OC int continentlist_points = -1; bool continentlist_only = false; int exclude_multilist_type = EXCLUDE_NONE; -bool mult_side = false; /* end LZ3NY mods */ bool portable_x2 = false; diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index 37f26118b..0f12c1760 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -56,6 +56,7 @@ bool exist_in_country_list(); +void Complain(char *msg); void KeywordNotSupported(const char *keyword); void ParameterNeeded(const char *keyword); void ParameterUnexpected(const char *keyword); @@ -809,9 +810,6 @@ static int cfg_countrylist(const cfg_arg_t arg) { } } - /* on which multiplier side of the rules we are */ - getpx(my.call); - mult_side = exist_in_country_list(); setcontest(whichcontest); free(buffer); @@ -912,10 +910,8 @@ static int cfg_continentlist(const cfg_arg_t arg) { } static int cfg_country_list_only(const cfg_arg_t arg) { - countrylist_only = true; - if (mult_side) { - countrylist_only = false; - } + Complain("USE_COUNTRYLIST_ONLY is deprecated, see man page"); + return PARSE_OK; } @@ -1457,7 +1453,7 @@ static config_t logcfg_configs[] = { {"DX_&_SECTIONS", NO_PARAM, cfg_dx_n_sections}, {"COUNTRYLIST", NEED_PARAM, cfg_countrylist}, {"CONTINENTLIST", NEED_PARAM, cfg_continentlist}, - {"USE_COUNTRYLIST_ONLY", NO_PARAM, cfg_country_list_only}, + {"USE_COUNTRYLIST_ONLY", OPTIONAL_PARAM, cfg_country_list_only}, {"SIDETONE_VOLUME", NEED_PARAM, cfg_sc_volume}, {"MFJ1278_KEYER", NEED_PARAM, cfg_mfj1278_keyer}, {"CHANGE_RST", OPTIONAL_PARAM, cfg_change_rst}, diff --git a/src/score.c b/src/score.c index eedc7fa79..9c9278073 100644 --- a/src/score.c +++ b/src/score.c @@ -2,8 +2,7 @@ * Tlf - contest logging program for amateur radio operators * Copyright (C) 2001-2002-2003 Rein Couperus * 2013 Ervin Hegedus - * 2013-2015, 2020 - * Thomas Beierlein + * 2013-2023 Thomas Beierlein * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +97,7 @@ bool exist_in_country_list() { } -/* HA2OS - check if continent is in CONTINENT_LIST from logcfg.dat */ +/* check if continent is in CONTINENT_LIST */ bool is_in_continentlist(char *continent) { int i = 0; @@ -112,8 +111,7 @@ bool is_in_continentlist(char *continent) { } -/* apply bandweight scoring * - * at the moment only LOWBAND_DOUBLES (<30m) can be active */ +/* apply bandweight scoring */ int apply_bandweight(int points, int bandindex) { if (lowband_point_mult && (bandindex < BANDINDEX_30)) @@ -148,53 +146,38 @@ int scoreByMode(struct qso_t *qso) { } } -/* Overwrite points with x if set */ -#define USE_IF_SET(x) do { \ + +/* return x points if set */ +#define RETURN_IF_SET(x) do { \ if (x >= 0) \ - points = x; \ + return x; \ } while(0); int scoreByContinentOrCountry(struct qso_t *qso) { - int points = 0; prefix_data *ctyinfo = getctyinfo(qso->call); bool inCountryList = is_in_countrylist(ctyinfo->dxcc_ctynr); - if (countrylist_only) { - points = 0; - if (inCountryList) - USE_IF_SET(countrylist_points); + if (ctyinfo->dxcc_ctynr == my.countrynr) { + RETURN_IF_SET(my_country_points); + } - return points; + if (inCountryList) { + RETURN_IF_SET(countrylist_points); } - /* HA2OS mods */ - if (continentlist_only) { - points = 0; - // only continent list allowed - if (is_in_continentlist(ctyinfo->continent)) { - USE_IF_SET(continentlist_points); - // overwrite if own continent and my_cont_points set - if (strcmp(ctyinfo->continent, my.continent) == 0) { - USE_IF_SET(my_cont_points); - } - } - return points; + if (strcmp(ctyinfo->continent, my.continent) == 0) { + RETURN_IF_SET(my_cont_points); } - // default - if (ctyinfo->dxcc_ctynr == my.countrynr) { - points = 0; - USE_IF_SET(my_cont_points); - USE_IF_SET(my_country_points); - } else if (inCountryList) { - USE_IF_SET(countrylist_points); - } else if (strcmp(ctyinfo->continent, my.continent) == 0) { - USE_IF_SET(my_cont_points); - } else - USE_IF_SET(dx_cont_points); + if (is_in_continentlist(ctyinfo->continent)) { + RETURN_IF_SET(continentlist_points); + } - return points; + if (strcmp(ctyinfo->continent, my.continent) != 0) { + RETURN_IF_SET(dx_cont_points); + } + return 0; } diff --git a/test/data.c b/test/data.c index 06ffa8808..ce082db29 100644 --- a/test/data.c +++ b/test/data.c @@ -83,13 +83,11 @@ int my_country_points = -1; int my_cont_points = -1; int dx_cont_points = -1; char countrylist[255][6]; -bool countrylist_only = false; int countrylist_points = -1; char continent_multiplier_list[7][3]; // SA, NA, EU, AF, AS and OC int continentlist_points = -1; bool continentlist_only = false; int exclude_multilist_type = EXCLUDE_NONE; -bool mult_side = false; /* end LZ3NY mods */ bool portable_x2 = false; diff --git a/test/rules/okom_dx/logcfg.dat b/test/rules/okom_dx/logcfg.dat new file mode 100644 index 000000000..41e9bc7da --- /dev/null +++ b/test/rules/okom_dx/logcfg.dat @@ -0,0 +1,2 @@ +RULES=okom +CALL=PA0XXX diff --git a/test/rules/okom_dx/ok_om.txt b/test/rules/okom_dx/ok_om.txt new file mode 120000 index 000000000..8fd24d347 --- /dev/null +++ b/test/rules/okom_dx/ok_om.txt @@ -0,0 +1 @@ +../../../share/ok_om.txt \ No newline at end of file diff --git a/test/rules/okom_dx/okom.log b/test/rules/okom_dx/okom.log new file mode 100644 index 000000000..4c7a9510f --- /dev/null +++ b/test/rules/okom_dx/okom.log @@ -0,0 +1,7 @@ + 40CW 02-Aug-26 07:09 0001 OK1ABF 599 599 ELO OK ELO 10 + 40SSB 02-Aug-26 07:09 0002 OK1AD 599 599 CTA CTA 10 + 40CW 02-Aug-26 07:10 0003 OM0AD 599 599 BAR OM BAR 10 + 40CW 02-Aug-26 07:11 0004 F4DDD 599 599 281 F 3 + 40CW 02-Aug-26 07:12 0005 VA5EEE 599 599 032 VE 5 + 40CW 02-Aug-26 07:13 0006 9A6FFF/MM 599 599 007 5 + 80CW 02-Aug-26 07:14 0007 PA7GGG 599 599 081 PA 1 diff --git a/test/rules/okom_dx/rules/okom b/test/rules/okom_dx/rules/okom new file mode 120000 index 000000000..0183646ae --- /dev/null +++ b/test/rules/okom_dx/rules/okom @@ -0,0 +1 @@ +../../../../rules/okom/okom \ No newline at end of file diff --git a/test/rules/okom_dx/rules/okom.py b/test/rules/okom_dx/rules/okom.py new file mode 120000 index 000000000..b80f5e7c2 --- /dev/null +++ b/test/rules/okom_dx/rules/okom.py @@ -0,0 +1 @@ +../../../../rules/okom/okom.py \ No newline at end of file diff --git a/test/rules/spdx_dx/logcfg.dat b/test/rules/spdx_dx/logcfg.dat new file mode 100644 index 000000000..1ded491c4 --- /dev/null +++ b/test/rules/spdx_dx/logcfg.dat @@ -0,0 +1,2 @@ +RULES=spdx_dx +CALL=N0CALL diff --git a/test/rules/spdx_dx/rules/spdx_dx b/test/rules/spdx_dx/rules/spdx_dx new file mode 120000 index 000000000..926854412 --- /dev/null +++ b/test/rules/spdx_dx/rules/spdx_dx @@ -0,0 +1 @@ +../../../../rules/spdx_dx \ No newline at end of file diff --git a/test/rules/spdx_dx/spdx.log b/test/rules/spdx_dx/spdx.log new file mode 100644 index 000000000..b187d7222 --- /dev/null +++ b/test/rules/spdx_dx/spdx.log @@ -0,0 +1,5 @@ + 40CW 28-Jul-26 19:21 0001 SP1AAA 599 599 B B 3 7012.0 + 40CW 28-Jul-26 19:21 0002 SP2BBB 599 599 C C 3 7012.0 + 40CW 28-Jul-26 19:21 0003 SP3CCC 599 599 D D 3 7012.0 + 40SSB 28-Jul-26 19:21 0004 SP4DDD 599 599 C 3 7012.0 + 40CW 28-Jul-26 19:37 0005 PA5EEE 599 599 324 0 7012.0 diff --git a/test/rules/spdx_dx/spdxmults b/test/rules/spdx_dx/spdxmults new file mode 120000 index 000000000..c28f7d562 --- /dev/null +++ b/test/rules/spdx_dx/spdxmults @@ -0,0 +1 @@ +../../../share/spdxmults \ No newline at end of file diff --git a/test/rules/spdx_sp/logcfg.dat b/test/rules/spdx_sp/logcfg.dat new file mode 100644 index 000000000..e9461a487 --- /dev/null +++ b/test/rules/spdx_sp/logcfg.dat @@ -0,0 +1,2 @@ +RULES=spdx_sp +CALL=SP0XXX diff --git a/test/rules/spdx_sp/rules/spdx_sp b/test/rules/spdx_sp/rules/spdx_sp new file mode 120000 index 000000000..5f5e6b491 --- /dev/null +++ b/test/rules/spdx_sp/rules/spdx_sp @@ -0,0 +1 @@ +../../../../rules/spdx_sp \ No newline at end of file diff --git a/test/rules/spdx_sp/spdx.log b/test/rules/spdx_sp/spdx.log new file mode 100644 index 000000000..ce0ec5215 --- /dev/null +++ b/test/rules/spdx_sp/spdx.log @@ -0,0 +1,6 @@ + 40CW 30-Jul-26 05:43 0001 DL1AAA 599 599 076 DL 1 + 40CW 30-Jul-26 05:43 0002 EA2BBB 599 599 034 EA 1 + 40SSB 30-Jul-26 05:44 0003 DL3CCC 599 599 531 1 + 40CW 30-Jul-26 05:44 0004 SP4DDD 599 599 C 0 + 80CW 30-Jul-26 05:44 0005 HA5EEE 599 599 073 HA 1 + 40CW 30-Jul-26 05:45 0006 K6FFF 599 599 002 K 3 diff --git a/test/test_addcall.c b/test/test_addcall.c index 7187dc31d..2504ff076 100644 --- a/test/test_addcall.c +++ b/test/test_addcall.c @@ -59,8 +59,6 @@ int setup_default(void **state) { strcpy(countrylist[1], "CE"); strcpy(countrylist[2], ""); - countrylist_only = false; - strcpy(continent_multiplier_list[0], "EU"); strcpy(continent_multiplier_list[1], "NA"); strcpy(continent_multiplier_list[2], ""); diff --git a/test/test_parse_logcfg.c b/test/test_parse_logcfg.c index 954b24123..523fd81ab 100644 --- a/test/test_parse_logcfg.c +++ b/test/test_parse_logcfg.c @@ -179,7 +179,6 @@ int setup_default(void **state) { using_named_nodes = false; xplanet = MARKER_NONE; dx_arrlsections = false; - mult_side = false; countrylist_points = -1; my_country_points = -1; my_cont_points = -1; @@ -1153,7 +1152,6 @@ void test_countrylist(void **state) { assert_string_equal(countrylist[1], "GM"); assert_string_equal(countrylist[2], "F"); assert_string_equal(countrylist[3], ""); - assert_true(mult_side); assert_int_equal(CONTEST_IS(UNKNOWN), 1); } @@ -1171,7 +1169,6 @@ void test_countrylist_long(void **state) { assert_string_equal(countrylist[128], "VU"); assert_string_equal(countrylist[160], "ZS8"); assert_string_equal(countrylist[161], ""); - assert_false(mult_side); assert_int_equal(CONTEST_IS(UNKNOWN), 1); } @@ -1183,7 +1180,6 @@ void test_countrylist_from_file(void **state) { assert_string_equal(countrylist[0], "EA"); assert_string_equal(countrylist[1], "CT"); assert_string_equal(countrylist[2], ""); - assert_true(mult_side); assert_int_equal(CONTEST_IS(UNKNOWN), 1); } @@ -1203,7 +1199,6 @@ void test_countrylist_from_file_long(void **state) { assert_string_equal(countrylist[128], "VU"); assert_string_equal(countrylist[160], "ZS8"); assert_string_equal(countrylist[161], ""); - assert_true(mult_side); assert_int_equal(CONTEST_IS(UNKNOWN), 1); } @@ -1213,19 +1208,6 @@ void test_countrylist_points(void **state) { assert_int_equal(countrylist_points, 4); } -void test_countrylist_only(void **state) { - int rc = call_parse_logcfg("USE_COUNTRYLIST_ONLY\n"); - assert_int_equal(rc, PARSE_OK); - assert_true(countrylist_only); -} - -void test_countrylist_only_mult_side(void **state) { - mult_side = true; - int rc = call_parse_logcfg("USE_COUNTRYLIST_ONLY\n"); - assert_int_equal(rc, PARSE_OK); - assert_false(countrylist_only); -} - void test_my_country_points(void **state) { int rc = call_parse_logcfg("MY_COUNTRY_POINTS=4\n"); assert_int_equal(rc, PARSE_OK); diff --git a/test/test_score.c b/test/test_score.c index 2131a7f80..f8a305fb6 100644 --- a/test/test_score.c +++ b/test/test_score.c @@ -22,7 +22,10 @@ // OBJECT ../src/setcontest.o // OBJECT ../src/utils.o +/* dummy functions */ void checkexchange(struct qso_t *qso, bool interactive) {} +void clear_display() {} + char *calc_continent(int zone); @@ -37,16 +40,6 @@ struct qso_t qso = { }; g_free(qso.call); \ qso.call = NULL; }while(0) -void clear_display() {} - -#if 0 -void __wrap_qrb(char *x, char *y, char *u, char *v, double *a, double *b) { -} - -int __wrap_foc_score() { - return 0; -} -#endif int setup_default(void **state) { @@ -71,11 +64,9 @@ int setup_default(void **state) { my_cont_points = -1; dx_cont_points = -1; - countrylist_only = false; countrylist_points = -1; strcpy(countrylist[0], ""); - continentlist_only = false; continentlist_points = -1; strcpy(continent_multiplier_list[0], ""); @@ -153,7 +144,6 @@ void test_wpx(void **state) { qso.bandindex = BANDINDEX_40; check_call_points("VE3ABC",4); - } @@ -183,7 +173,6 @@ void test_arrl_fd(void **state) { qso.mode = SSBMODE; check_points(1); - } @@ -306,111 +295,74 @@ void test_in_continentlist(void **state) { assert_int_equal(is_in_continentlist("NA"), true); } - -void test_scoreByCorC_countrylistOnly(void **state) { - countrylist_only = true; +void test_scoreByCorC_no_points_set(void **state) { + /* empty_lists */ check_call_points("LZ1AB", 0); - check_call_points("DL3XYZ", 0); + check_call_points("XE2AAA", 0); + check_call_points("JA4BB", 0); + /* lists initialized */ init_countrylist(); + init_continentlist(); check_call_points("LZ1AB", 0); - check_call_points("DL3XYZ", 0); - - countrylist_points = 4; - check_call_points("LZ1AB", 0); - check_call_points("DL3XYZ", 4); + check_call_points("XE2AAA", 0); + check_call_points("JA4BB", 0); } -void test_scoreByCorC_continentlistOnly(void **state) { - continentlist_only = true; - /* empty list */ +void test_scoreByCorC_dxPoints(void **state) { + dx_cont_points = 3; check_call_points("LZ1AB", 0); + check_call_points("JA4BB", 3); +} +void test_scoreByCorC_continentlistPoints(void **state) { init_continentlist(); + continentlist_points = 4; - /* no list points given */ - check_call_points("LZ1AB", 0); - check_call_points("JA4BB", 0); - - /* same, but my_cont_points set */ - my_cont_points = 1; - check_call_points("LZ1AB", 1); - check_call_points("XE2AAA", 0); - check_call_points("JA4BB", 0); - - /* my_cont_points, cont_list_points given */ - continentlist_points = 2; - check_call_points("LZ1AB", 1); - check_call_points("XE2AAA", 2); - check_call_points("JA4BB", 0); - - /* only cont_list_points given */ - my_cont_points = -1; - check_call_points("LZ1AB", 2); - check_call_points("XE2AAA", 2); + check_call_points("LZ1AB", 4); + check_call_points("XE2AAA", 4); check_call_points("JA4BB", 0); } +void test_scoreByCorC_myContinentPoints(void **state) { + my_cont_points = 2; -void test_scoreByCorC_continentlistOnly_ignoreDxContPoints(void **state) { - continentlist_only = true; - check_call_points("LZ1AB", 0); - - dx_cont_points = 2; - init_continentlist(); - check_call_points("LZ1AB", 0); + check_call_points("LZ1AB", 2); check_call_points("XE2AAA", 0); + check_call_points("JA4BB", 0); } +void test_scoreByCorC_countrylistPoints(void **state) { + init_countrylist(); + countrylist_points = 3; -void test_scoreByCorC_notInList(void **state) { - - /* my_country/cont_points and dx_cont_points not set */ - check_call_points("DL3XYZ", 0); - check_call_points("LZ1AB", 0); - check_call_points("K3XX", 0); - - dx_cont_points = 4; - check_call_points("DL3XYZ", 0); - check_call_points("LZ1AB", 0); - check_call_points("K3XX", 4); - - my_cont_points = 3; + check_call_points("OE2ABC", 3); check_call_points("DL3XYZ", 3); - check_call_points("LZ1AB", 3); - check_call_points("K3XX", 4); + check_call_points("JA4BB", 0); +} +void test_scoreByCorC_myCountryPoints(void **state) { my_country_points = 1; + + check_call_points("OE2ABC", 0); check_call_points("DL3XYZ", 1); - check_call_points("LZ1AB", 3); - check_call_points("K3XX", 4); } -void test_scoreByCorC_InList(void **state) { +void test_scoreByCorC_precedence(void **state) { init_countrylist(); - - /* countrylist_points, my_country_points and my_cont_points - * not set -> 0 points for all */ - check_call_points("OE2BL", 0); - check_call_points("DL3XYZ", 0); - check_call_points("K3XX", 0); - - /* only countrylist_points set -> use my_country/cont_points for - * my own country , otherwise 0 ??? */ - countrylist_points = 3; - check_call_points("OE2BL", 3); - check_call_points("DL3XYZ", 0); - check_call_points("K3XX", 3); - - my_cont_points = 2; - check_call_points("OE2BL", 3); - check_call_points("DL3XYZ", 2); - check_call_points("K3XX", 3); + init_continentlist(); my_country_points = 1; - check_call_points("OE2BL", 3); - check_call_points("DL3XYZ", 1); - check_call_points("K3XX", 3); + countrylist_points = 2; + my_cont_points = 3; + continentlist_points = 4; + dx_cont_points = 5; + + check_call_points("DL3XYZ", 1); /* my country */ + check_call_points("OE2ABC", 2); /* in countrylist */ + check_call_points("K3XX", 2); /* same as above */ + check_call_points("LZ1AB", 3); /* own continent */ + check_call_points("XE2AAA", 4); /* in continentlist */ + check_call_points("JA4BB", 5); /* other continent */ } - diff --git a/tlf.1.in b/tlf.1.in index 9c8f207a6..fe0a5b929 100644 --- a/tlf.1.in +++ b/tlf.1.in @@ -2837,8 +2837,8 @@ instead. Points for countries in country list. . .TP -\fBUSE_COUNTRYLIST_ONLY\fR[=<\fION\fR|\fIOFF\fR>] -Score zero points for countries not in the list. +\fUSE_COUNTRYLIST_ONLY\fR +Deprecated. Please do not use any longer. . .TP \fBCOUNTRYLIST\fR=\fI"comma separated list of prefixes"\fR