LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
TestCasesHandler.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/***************************************************************************
7 * Copyright (C) 2004 by Benoit Mathieu *
8 * mathieub@zoe.cea.fr *
9 * *
10 ***************************************************************************/
11
12#ifndef LIMA_TGV_TESTCASESHANDLER_H
13#define LIMA_TGV_TESTCASESHANDLER_H
14
15#include "TestCase.h"
16#include "TestCaseProcessor.hpp"
17
18#include <QtXml/QXmlDefaultHandler>
19
20namespace Lima
21{
22namespace Common
23{
24namespace TGV
25{
26class LIMA_TGV_EXPORT TestCasesHandler : public QXmlDefaultHandler
27{
28
29public:
31 virtual ~ TestCasesHandler();
32
33 // -----------------------------------------------------------------------
34 // Implementations of the SAX DocumentHandler interface
35 // -----------------------------------------------------------------------
36 bool endElement(const QString & namespaceURI, const QString & name, const QString & qName) override;
37
38 bool characters(const QString& chars) override;
39
40 bool startElement(const QString & namespaceURI, const QString & name, const QString & qName, const QXmlAttributes & attributes) override;
41
42 bool startDocument() override;
43
44 inline bool hasFatalError() const { return m_hasFatalError; }
45
46
47 struct TestReport {
48 uint64_t success;
49 uint64_t failed;
50 uint64_t conditional;
51 uint64_t nbtests;
52 TestReport() : success(0),failed(0),conditional(0),nbtests(0) {};
53 };
54
55 std::map<std::string,TestReport> m_reportByType;
56
57private:
58 std::string attributeValue(const QString& attr, const QXmlAttributes& attrs) const;
59
60 // Liste des parametres possibles et obligatoires dans un TestCase
61 // pour lp: (text, language, pipeline?...)
62 // std::map<std::string,bool> m_simpleValParamTestCaseKeys;
63 // std::map<std::string,bool> m_multiValParamTestCaseKeys;
64
65 TestCaseProcessor& m_processor;
66 TestCase currentTestCase;
67
68 std::string getName(const QString& localName,
69 const QString& qName);
70
71 bool m_inText;
72 bool m_inExpl;
73 bool m_inParam;
74 bool m_inList;
75 bool m_inMap;
76 std::string m_listKey;
77 std::string m_mapKey;
78
79 bool m_hasFatalError;
80};
81
82// This utility function return a user-defined exit code (64) if a "bloquant"
83// test failed.
85
86} // TGV
87} // Common
88} // Lima
89
90
91#endif
#define LIMA_TGV_EXPORT
std::map< std::string, TestReport > m_reportByType
int exitCode(TestCasesHandler const &tch)
NAUTITIA.