factor out common code in tests
rewrite shape layer, again

"Generalizations" of a shape have become "dependencies": the
dependencies of a shape are instantiated and passed to the corresponding
BaseShapeFunc constructor.

Also introduced a useful shape type: LINEAR_DOUBLE.