Skip to content

Commit

Permalink
Ensures PyImath tests pass.
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Thompson <oxt3479@rit.edu>
  • Loading branch information
oxt3479 committed Jun 23, 2020
1 parent 279e160 commit bd54e6b
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 59 deletions.
120 changes: 120 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
# AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
# AllowShortLambdasOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test|_test)?$'
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 8
PenaltyBreakBeforeFirstCallParameter: 8
PenaltyBreakComment: 1000
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 20
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Always
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
#UseTab: ForIndentation
UseTab: Never
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
7 changes: 4 additions & 3 deletions python/PyImath/PyImathMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ jacobiEigensolve(const Matrix& m)
{
const T Aij = m[i][j],
Aji = m[j][i];
assert (std::abs(Aij - Aji) < tol);
// TODO: IEX_NAMESPACE::ArgExc,
// "Symmetric eigensolve requires a symmetric matrix (matrix[i][j] == matrix[j][i]).");
if (std::abs(Aij - Aji) >= tol){
throw std::invalid_argument
("Symmetric eigensolve requires a symmetric matrix (matrix[i][j] == matrix[j][i]).");
}
}
}

Expand Down
56 changes: 0 additions & 56 deletions python/PyImathTest/pyImathTest.in
Original file line number Diff line number Diff line change
Expand Up @@ -1666,62 +1666,6 @@ testList.append(('testMaskedV3fArray', lambda : testMaskedVecTypeArray(V3fArray)
testList.append(('testMaskedV3dArray', lambda : testMaskedVecTypeArray(V3dArray)))


# -------------------------------------------------------------------------
# Tests for exceptions defined in imath module

def testExceptions():

# Verify that the exception classes defined in imath
# are caught by "except NullVecExc", "except RuntimeError"

try:
raise NullVecExc
except NullVecExc:
pass
else:
assert 0

try:
raise NullVecExc
except RuntimeError:
pass
else:
assert 0

try:
raise NullQuatExc
except RuntimeError:
pass
else:
assert 0

try:
raise SingMatrixExc
except RuntimeError:
pass
else:
assert 0
try:
raise ZeroScaleExc
except RuntimeError:
pass
else:
assert 0

try:
raise IntVecNormalizeExc
except RuntimeError:
pass
else:
assert 0

print ("ok")
return


testList.append (('testExceptions',testExceptions))


# -------------------------------------------------------------------------
# Tests for functions

Expand Down

0 comments on commit bd54e6b

Please sign in to comment.