Skip to content
Snippets Groups Projects
Select Git revision
  • 9a11779168d06bb972ece7ed99d0ec6cd75d5096
  • master default protected
  • develop protected
  • feat_remove_attr
  • python2.7
  • python3.8
6 results

test_remove_attr.py

Blame
  • strsetfunctions.cpp 6.26 KiB
    #include <boost/test/unit_test.hpp>
    #include <boost/bind.hpp>
    #include <boost/shared_ptr.hpp>
    #include <libcorpus2/sentence.h>
    
    
    #include <libwccl/values/strset.h>
    #include <libwccl/sentencecontext.h>
    #include <libwccl/ops/functions/strset/tolower.h>
    #include <libwccl/ops/functions/strset/toupper.h>
    #include <libwccl/ops/functions/strset/affix.h>
    #include <libwccl/ops/functions/constant.h>
    
    using namespace Wccl;
    
    BOOST_AUTO_TEST_SUITE(strset_functions)
    
    struct StrSetFix
    {
    	StrSetFix()
    		: sc(boost::make_shared<Corpus2::Sentence>()),
    		  tagset(),
    		  cx(sc, boost::make_shared<Variables>()),
    		  strset(),
    		  strset_expr()
    	{
    		strset.insert("alllower");
    		strset.insert("Firstcapital");
    		strset.insert("PascalCase");
    		strset.insert("camelCase");
    		strset.insert("some1325numbers");
    		strset.insert("ALLUPPER");
    		strset.insert("kIdSpEeChLoL");
    		strset.insert("short");
    
    		strset_expr.reset(new Constant<StrSet>(strset));
    	}
    	SentenceContext sc;
    	Corpus2::Tagset tagset;
    	FunExecContext cx;
    
    	StrSet strset;
    	boost::shared_ptr<Function<StrSet> > strset_expr;
    };
    
    BOOST_FIXTURE_TEST_CASE(lower, StrSetFix)
    {
    	StrSet lowerset;
    	lowerset.insert("alllower");
    	lowerset.insert("firstcapital");
    	lowerset.insert("pascalcase");
    	lowerset.insert("camelcase");
    	lowerset.insert("some1325numbers");
    	lowerset.insert("allupper");
    	lowerset.insert("kidspeechlol");
    	lowerset.insert("short");
    
    	ToLower to_lower(strset_expr);
    
    	BOOST_CHECK(lowerset.equals(*to_lower.apply(cx)));
    }
    
    BOOST_FIXTURE_TEST_CASE(upper, StrSetFix)
    {
    	StrSet upperset;
    	upperset.insert("ALLLOWER");
    	upperset.insert("FIRSTCAPITAL");
    	upperset.insert("PASCALCASE");
    	upperset.insert("CAMELCASE");
    	upperset.insert("SOME1325NUMBERS");