Changeset 4316
- Timestamp:
- Feb 17, 2023, 2:40:50 AM (3 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/0.20-stable merged: 4309-4311,4313-4314
- Property svn:mergeinfo changed
-
trunk/NEWS
r4308 r4316 11 11 12 12 yat 0.20.x series from http://dev.thep.lu.se/yat/svn/branches/0.20-stable 13 14 version 0.20.2 (released 17 February 2023) 15 - Fixed bug in VCF::Info::set(2) (bug #995) 16 17 A complete list of closed tickets can be found here [[br]] 18 http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.20.2 13 19 14 20 version 0.20.1 (released 10 February 2023) -
trunk/m4/version.m4
r4308 r4316 102 102 # yat-0.20 17:0:0 103 103 # yat-0.20.1 17:1:0 104 # yat-0.20.2 17:2:0 104 105 # 105 106 # *Accidently, the libtool number was not updated for yat 0.5 -
trunk/test/vcf.cc
r4170 r4316 1 1 // $Id$ 2 2 // 3 // Copyright (C) 2018, 2020, 2022 Peter Johansson3 // Copyright (C) 2018, 2020, 2022, 2023 Peter Johansson 4 4 // 5 5 // This program is free software; you can redistribute it and/or modify … … 32 32 using namespace theplu::yat; 33 33 34 template<typename T> 35 void equal_vec(test::Suite& suite, std::vector<T> x, std::vector<T> y) 36 { 37 if (x != y) { 38 suite.add(false); 39 if (x.size() != y.size()) 40 suite.err() << "error: vectors not the same\n" 41 << "x size: " << x.size() << "\n" 42 << "y size: " << y.size() << "\n"; 43 else 44 for (size_t i=0; i<x.size(); ++i) 45 std::cerr << "'" << x[i] << "' : '" << y[i] << "'\n"; 46 } 47 } 48 49 50 template<typename T1, typename T2> 51 void equal(test::Suite& suite, T1 x, T2 y) 52 { 53 if (x != y) { 54 suite.add(false); 55 suite.err() << "error: " << x << " != " << y << "\n"; 56 } 57 } 58 59 60 void test_info(test::Suite& suite, omic::VCF::Info info) 61 { 62 std::string value; 63 info.add("FOO", "foo"); 64 info.get(value, "FOO"); 65 equal(suite, value, "foo"); 66 67 info.set("FOO", "foo2"); 68 info.get(value, "FOO"); 69 equal(suite, value, "foo2"); 70 71 int x; 72 info.add("X", "1"); 73 info.get(x, "X"); 74 equal(suite, x, 1); 75 76 info.set("X", 2); 77 info.get(x, "X"); 78 equal(suite, x, 2); 79 80 std::vector<std::string> values; 81 std::vector<std::string> foos(2, "fu"); 82 info.add("FOOS", foos); 83 info.get(values, "FOOS"); 84 equal_vec(suite, values, foos); 85 info.set("FOOS", foos); 86 info.get(value, "FOOS"); 87 equal_vec(suite, values, foos); 88 89 std::vector<int> y; 90 std::vector<int> bars(2, 13); 91 info.add("BARS", bars); 92 info.get(y, "BARS"); 93 equal_vec(suite, y, bars); 94 info.set("BARS", bars); 95 info.get(y, "BARS"); 96 equal_vec(suite, y, bars); 97 } 98 99 34 100 int main(int argc, char* argv[]) 35 101 { … … 104 170 105 171 suite.out() << "test info\n"; 172 test_info(suite, vcf.info()); 106 173 suite.add(vcf.info().str() == ""); 107 174 vcf.info().set("SNV"); -
trunk/yat/omic/VCF.h
r4171 r4316 5 5 6 6 /* 7 Copyright (C) 2018, 2019, 2020, 2022 Peter Johansson7 Copyright (C) 2018, 2019, 2020, 2022, 2023 Peter Johansson 8 8 9 9 This file is part of the yat library, http://dev.thep.lu.se/yat … … 221 221 /** 222 222 Add entry \a key to semicolon-delimited list of entries. 223 224 If \a key is already present, the behaviour is undefined. 223 225 */ 224 226 void add(const std::string& key); … … 227 229 T is either string or numeric or a std::vector with strings 228 230 or numerics. 231 232 If \a key is already present, the behaviour is undefined. 229 233 */ 230 234 template<typename T> … … 242 246 243 247 /** 244 get value corresponding to \a key 248 get value corresponding to \a key. If \a key is not present, 249 result is as value is empty string. 245 250 246 251 T is string, numeric, vector<string> or vector<numeric> … … 270 275 271 276 /** 277 If \a key is absent, equivalent to call add(key, value). If 278 \a key present, erase its value and set to \a value. 279 272 280 T is either string or numeric or a std::vector with strings 273 281 or numerics. … … 685 693 str_ = ""; 686 694 auto it = map_.lower_bound(key); 687 if (it==map_.end() &&it->first!=key) {695 if (it==map_.end() || it->first!=key) { 688 696 keys_.push_back(key); 689 697 it = map_.insert(it, std::make_pair(key, "")); 690 698 } 699 else 700 it->second.clear(); 691 701 detail::Appender<T> append(','); 692 702 append(it->second, value);
Note: See TracChangeset
for help on using the changeset viewer.