D11907: advancedqueryparsertest: Add optimization test

Stefan BrĂ¼ns noreply at phabricator.kde.org
Wed Apr 4 21:39:00 UTC 2018


bruns added a comment.


  Although this is probably a useful addition (haven't checked which cases the existing unit test already cover), it does not cover the changes in D11826 <https://phabricator.kde.org/D11826>.
  
  The code in https://cgit.kde.org/baloo.git/tree/src/lib/advancedqueryparser.cpp#n100 replicates the new logic in the `Term::Term(Term&, Operation&, Term&)` constructor (merging of compatible terms), and, after the changes in D11826 <https://phabricator.kde.org/D11826>, could be replaced with just
  
    static void addTermToStack(QStack<Term>& stack, const Term& termInConstruction, Term::Operation op)
    {
        auto top = stack.pop();
        stack.push(Term(top, op, termInConstruction));
    }
  
  `operator&&` is e.g. used in
  https://cgit.kde.org/baloo.git/tree/src/lib/query.cpp#n189
  
  To test operator&&, the following should be true:
  
    Term{Term:And, {Term{"", "a"}, Term{"", "b"}, Term{"", "c"}, Term{"", "d"} }
    ==
    Term{"", "a"} && Term{"", "b"} && Term{"", "c"} && Term{"", "d"}

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D11907

To: michaelh, #baloo, bruns
Cc: #frameworks, ashaposhnikov, michaelh, astippich, spoorun, ngraham, alexeymin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180404/3bb1982a/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list