/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Collapse adjacent values, and check whether the array is sorted. */
d->bSorted = true;
+ if (d->nas == 0)
+ {
+ return;
+ }
for (i = 1, j = 0; i < d->nas; ++i)
{
if (d->as.i[i] != d->as.i[j])
* For strings, it's unlikely that the values would be sorted originally,
* so set bSorted always to false. */
d->bSorted = false;
+ if (d->nas == 0)
+ {
+ return;
+ }
d->as_s_sorted[0] = d->as.s[0];
for (i = 1, j = 0; i < d->nas; ++i)
{
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <ParsedSelections Name="Parsed">
+ <ParsedSelection Name="Selection1">
+ <String Name="Input">same residue as none</String>
+ <String Name="Text">same residue as none</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ <ParsedSelection Name="Selection2">
+ <String Name="Input">same resname as none</String>
+ <String Name="Text">same resname as none</String>
+ <Bool Name="Dynamic">false</Bool>
+ </ParsedSelection>
+ </ParsedSelections>
+ <CompiledSelections Name="Compiled">
+ <Selection Name="Selection1">
+ <Sequence Name="Atoms">
+ <Int Name="Length">0</Int>
+ </Sequence>
+ </Selection>
+ <Selection Name="Selection2">
+ <Sequence Name="Atoms">
+ <Int Name="Length">0</Int>
+ </Sequence>
+ </Selection>
+ </CompiledSelections>
+</ReferenceData>
}
+TEST_F(SelectionCollectionDataTest, HandlesEmptyReferenceForSame)
+{
+ static const char * const selections[] = {
+ "same residue as none",
+ "same resname as none"
+ };
+ runTest("simple.gro", selections);
+}
+
+
TEST_F(SelectionCollectionDataTest, HandlesNumericComparisons)
{
static const char * const selections[] = {