• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/gametest/integration/TestItemStackOperators.java
1
package org.cyclops.integrateddynamics.gametest.integration;
2

3
import net.minecraft.core.component.DataComponents;
4
import net.minecraft.nbt.CompoundTag;
5
import net.minecraft.nbt.IntTag;
6
import net.minecraft.world.item.ItemStack;
7
import net.minecraft.world.item.Items;
8
import net.minecraft.world.item.Rarity;
9
import net.minecraft.world.item.component.OminousBottleAmplifier;
10
import net.minecraft.world.item.enchantment.Enchantments;
11
import net.minecraft.world.level.block.Blocks;
12
import net.minecraft.world.level.block.LeavesBlock;
13
import net.minecraft.world.level.material.Fluids;
14
import net.neoforged.neoforge.capabilities.Capabilities;
15
import net.neoforged.neoforge.fluids.FluidStack;
16
import net.neoforged.neoforge.server.ServerLifecycleHooks;
17
import net.neoforged.neoforge.transfer.ResourceHandler;
18
import net.neoforged.neoforge.transfer.access.ItemAccess;
19
import net.neoforged.neoforge.transfer.energy.EnergyHandler;
20
import net.neoforged.neoforge.transfer.item.ItemResource;
21
import net.neoforged.neoforge.transfer.transaction.Transaction;
22
import org.cyclops.cyclopscore.helper.EnchantmentHelpers;
23
import org.cyclops.cyclopscore.helper.IModHelpersNeoForge;
24
import org.cyclops.integrateddynamics.RegistryEntries;
25
import org.cyclops.integrateddynamics.api.evaluate.EvaluationException;
26
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
27
import org.cyclops.integrateddynamics.api.evaluate.variable.IVariable;
28
import org.cyclops.integrateddynamics.block.BlockEnergyBatteryBase;
29
import org.cyclops.integrateddynamics.block.BlockEnergyBatteryConfig;
30
import org.cyclops.integrateddynamics.core.evaluate.operator.Operators;
31
import org.cyclops.integrateddynamics.core.evaluate.variable.*;
32
import org.cyclops.integrateddynamics.core.helper.Helpers;
33
import org.cyclops.integrateddynamics.core.test.IntegrationBefore;
34
import org.cyclops.integrateddynamics.core.test.IntegrationTest;
35
import org.cyclops.integrateddynamics.core.test.TestHelpers;
36

37
/**
38
 * Test the different logical operators.
39
 * @author rubensworks
40
 */
41
public class TestItemStackOperators {
×
42

43
    private static final DummyValueType DUMMY_TYPE = DummyValueType.TYPE;
×
44
    private static final DummyVariable<DummyValueType.DummyValue> DUMMY_VARIABLE =
×
45
            new DummyVariable<DummyValueType.DummyValue>(DUMMY_TYPE, DummyValueType.DummyValue.of());
×
46

47
    private DummyVariableItemStack iApple;
48
    private DummyVariableItemStack iAppleNoData;
49
    private DummyVariableItemStack iApple2;
50
    private DummyVariableItemStack iAppleTag;
51
    private DummyVariableItemStack iBeef;
52
    private DummyVariableItemStack iEnderPearl;
53
    private DummyVariableItemStack iHoe;
54
    private DummyVariableItemStack iHoe100;
55
    private DummyVariableItemStack iHoeEnchanted;
56
    private DummyVariableItemStack iPickaxe;
57
    private DummyVariableItemStack iStone;
58
    private DummyVariableItemStack iDarkOakLeaves;
59
    private DummyVariableItemStack iBucketLava;
60
    private DummyVariableItemStack iWrench;
61
    private DummyVariableItemStack iEnergyBatteryEmpty;
62
    private DummyVariableItemStack iEnergyBatteryFull;
63
    private DummyVariableItemStack iIronOre;
64
    private DummyVariableItemStack iShulkerBox;
65
    private DummyVariableItemStack iSeedWheat;
66
    private DummyVariableItemStack iEmpty;
67

68
    private DummyVariableBlock bStone;
69
    private DummyVariableBlock bObsidian;
70

71
    private DummyVariable<ValueTypeString.ValueString> sPlankWood;
72
    private DummyVariable<ValueTypeString.ValueString> sMaxStackSize;
73

74
    private DummyVariable<ValueTypeInteger.ValueInteger> int100;
75
    private DummyVariable<ValueTypeInteger.ValueInteger> int200;
76

77
    private DummyVariable<ValueTypeString.ValueString> sApple;
78

79
    private DummyVariable<ValueTypeList.ValueList> lApples;
80

81
    private DummyVariable<ValueTypeNbt.ValueNbt> t4;
82

83
    @IntegrationBefore
84
    public void before() {
85
        iApple = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.APPLE)));
×
86
        iAppleNoData = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.APPLE)));
×
87
        iAppleNoData.getValue().getRawValue().remove(DataComponents.MAX_STACK_SIZE);
×
88
        iAppleNoData.getValue().getRawValue().remove(DataComponents.LORE);
×
89
        iAppleNoData.getValue().getRawValue().remove(DataComponents.ENCHANTMENTS);
×
90
        iAppleNoData.getValue().getRawValue().remove(DataComponents.REPAIR_COST);
×
91
        iAppleNoData.getValue().getRawValue().remove(DataComponents.ATTRIBUTE_MODIFIERS);
×
92
        iAppleNoData.getValue().getRawValue().remove(DataComponents.RARITY);
×
93
        iAppleNoData.getValue().getRawValue().remove(DataComponents.FOOD);
×
94
        iAppleNoData.getValue().getRawValue().remove(DataComponents.ITEM_NAME);
×
95
        iAppleNoData.getValue().getRawValue().remove(DataComponents.ITEM_MODEL);
×
96
        iAppleNoData.getValue().getRawValue().remove(DataComponents.CONSUMABLE);
×
97
        iApple2 = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.APPLE, 2)));
×
98
        ItemStack appleStack = new ItemStack(Items.APPLE);
×
99
        appleStack.set(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, new OminousBottleAmplifier(2));
×
100
        iAppleTag = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(appleStack));
×
101
        iBeef = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.RED_BED)));
×
102
        iEnderPearl = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.ENDER_PEARL)));
×
103
        iHoe = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.DIAMOND_HOE)));
×
104
        iHoe100 = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.DIAMOND_HOE)));
×
105
        iHoe100.getValue().getRawValue().setDamageValue(100);
×
106
        ItemStack hoeEnchanted = new ItemStack(Items.DIAMOND_HOE);
×
107
        EnchantmentHelpers.setEnchantmentLevel(hoeEnchanted, ServerLifecycleHooks.getCurrentServer().registryAccess().holderOrThrow(Enchantments.AQUA_AFFINITY), 1);
×
108
        hoeEnchanted.set(DataComponents.REPAIR_COST, 10);
×
109
        iHoeEnchanted = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(hoeEnchanted));
×
110
        iPickaxe = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.DIAMOND_PICKAXE)));
×
111
        iStone = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Blocks.STONE)));
×
112
        iDarkOakLeaves = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Blocks.DARK_OAK_LEAVES, 1)));
×
113
        iBucketLava = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.LAVA_BUCKET)));
×
114
        iWrench = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(RegistryEntries.ITEM_WRENCH)));
×
115
        iEnergyBatteryEmpty = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(RegistryEntries.ITEM_ENERGY_BATTERY)));
×
116
        ItemStack energyBatteryFull = new ItemStack(RegistryEntries.ITEM_ENERGY_BATTERY);
×
117
        EnergyHandler energyStorage = energyBatteryFull.getCapability(Capabilities.Energy.ITEM, ItemAccess.forStack(energyBatteryFull));
×
118
        BlockEnergyBatteryBase.fill(energyStorage);
×
119
        iEnergyBatteryFull = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(energyBatteryFull));
×
120
        iIronOre = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Blocks.IRON_ORE)));
×
121
        ItemStack shulkerBox = new ItemStack(Blocks.BLACK_SHULKER_BOX);
×
122
        ResourceHandler<ItemResource> itemHandler = shulkerBox.getCapability(Capabilities.Item.ITEM, ItemAccess.forStack(shulkerBox));
×
123
        try (var tx = Transaction.openRoot()) {
×
124
            itemHandler.insert(0, ItemResource.of(Items.APPLE), 1, tx);
×
125
            itemHandler.insert(10, ItemResource.of(Items.APPLE), 10, tx);
×
126
            tx.commit();
×
127
        }
128
        iShulkerBox = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(shulkerBox));
×
129
        iSeedWheat = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.WHEAT_SEEDS)));
×
130
        iEmpty = new DummyVariableItemStack(ValueObjectTypeItemStack.ValueItemStack.of(ItemStack.EMPTY));
×
131

132
        bStone = new DummyVariableBlock(ValueObjectTypeBlock.ValueBlock.of(Blocks.STONE.defaultBlockState()));
×
133
        bObsidian = new DummyVariableBlock(ValueObjectTypeBlock.ValueBlock.of(Blocks.OBSIDIAN.defaultBlockState()));
×
134

135
        sPlankWood = new DummyVariable<>(ValueTypes.STRING, ValueTypeString.ValueString.of("minecraft:planks"));
×
136
        sMaxStackSize = new DummyVariable<>(ValueTypes.STRING, ValueTypeString.ValueString.of("minecraft:max_stack_size"));
×
137

138
        int100 = new DummyVariable<>(ValueTypes.INTEGER, ValueTypeInteger.ValueInteger.of(100));
×
139
        int200 = new DummyVariable<>(ValueTypes.INTEGER, ValueTypeInteger.ValueInteger.of(200));
×
140

141
        sApple = new DummyVariable<>(ValueTypes.STRING, ValueTypeString.ValueString.of("minecraft:apple"));
×
142

143
        lApples = new DummyVariable<>(ValueTypes.LIST, ValueTypeList.ValueList.ofAll(
×
144
                iApple.getValue(),
×
145
                iApple2.getValue(),
×
146
                iIronOre.getValue(),
×
147
                iApple.getValue(),
×
148
                iApple.getValue(),
×
149
                iHoe.getValue(),
×
150
                iHoe100.getValue(),
×
151
                iApple2.getValue()
×
152
        ));
153

154
        t4 = new DummyVariable<>(ValueTypes.NBT, ValueTypeNbt.ValueNbt.of(IntTag.valueOf(4)));
×
155
    }
×
156

157
    /**
158
     * ----------------------------------- SIZE -----------------------------------
159
     */
160

161
    @IntegrationTest
162
    public void testItemStackSize() throws EvaluationException {
163
        IValue res1 = Operators.OBJECT_ITEMSTACK_SIZE.evaluate(new IVariable[]{iApple});
×
164
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
165
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 1, "size(apple:1) = 1");
×
166

167
        IValue res2 = Operators.OBJECT_ITEMSTACK_SIZE.evaluate(new IVariable[]{iApple2});
×
168
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 2, "size(apple:2) = 2");
×
169
    }
×
170

171
    @IntegrationTest(expected = EvaluationException.class)
172
    public void testInvalidInputSizeSizeLarge() throws EvaluationException {
173
        Operators.OBJECT_ITEMSTACK_SIZE.evaluate(new IVariable[]{iApple, iApple});
×
174
    }
×
175

176
    @IntegrationTest(expected = EvaluationException.class)
177
    public void testInvalidInputSizeSizeSmall() throws EvaluationException {
178
        Operators.OBJECT_ITEMSTACK_SIZE.evaluate(new IVariable[]{});
×
179
    }
×
180

181
    @IntegrationTest(expected = EvaluationException.class)
182
    public void testInvalidInputTypeSize() throws EvaluationException {
183
        Operators.OBJECT_ITEMSTACK_SIZE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
184
    }
×
185

186
    /**
187
     * ----------------------------------- MAXSIZE -----------------------------------
188
     */
189

190
    @IntegrationTest
191
    public void testItemStackMaxSize() throws EvaluationException {
192
        IValue res1 = Operators.OBJECT_ITEMSTACK_MAXSIZE.evaluate(new IVariable[]{iApple});
×
193
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
194
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 64, "maxsize(apple) = 64");
×
195

196
        IValue res2 = Operators.OBJECT_ITEMSTACK_MAXSIZE.evaluate(new IVariable[]{iEnderPearl});
×
197
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 16, "maxsize(enderpearl) = 16");
×
198
    }
×
199

200
    @IntegrationTest(expected = EvaluationException.class)
201
    public void testInvalidInputMaxSizeMaxSizeLarge() throws EvaluationException {
202
        Operators.OBJECT_ITEMSTACK_MAXSIZE.evaluate(new IVariable[]{iApple, iApple});
×
203
    }
×
204

205
    @IntegrationTest(expected = EvaluationException.class)
206
    public void testInvalidInputMaxSizeMaxSizeSmall() throws EvaluationException {
207
        Operators.OBJECT_ITEMSTACK_MAXSIZE.evaluate(new IVariable[]{});
×
208
    }
×
209

210
    @IntegrationTest(expected = EvaluationException.class)
211
    public void testInvalidInputTypeMaxSize() throws EvaluationException {
212
        Operators.OBJECT_ITEMSTACK_MAXSIZE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
213
    }
×
214

215
    /**
216
     * ----------------------------------- ISSTACKABLE -----------------------------------
217
     */
218

219
    @IntegrationTest
220
    public void testItemStackIsStackable() throws EvaluationException {
221
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISSTACKABLE.evaluate(new IVariable[]{iApple});
×
222
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
223
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), true, "isstackable(apple) = true");
×
224

225
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISSTACKABLE.evaluate(new IVariable[]{iHoe});
×
226
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), false, "isstackable(hoe) = false");
×
227
    }
×
228

229
    @IntegrationTest(expected = EvaluationException.class)
230
    public void testInvalidInputIsStackableIsStackableLarge() throws EvaluationException {
231
        Operators.OBJECT_ITEMSTACK_ISSTACKABLE.evaluate(new IVariable[]{iApple, iApple});
×
232
    }
×
233

234
    @IntegrationTest(expected = EvaluationException.class)
235
    public void testInvalidInputIsStackableIsStackableSmall() throws EvaluationException {
236
        Operators.OBJECT_ITEMSTACK_ISSTACKABLE.evaluate(new IVariable[]{});
×
237
    }
×
238

239
    @IntegrationTest(expected = EvaluationException.class)
240
    public void testInvalidInputTypeIsStackable() throws EvaluationException {
241
        Operators.OBJECT_ITEMSTACK_ISSTACKABLE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
242
    }
×
243

244
    /**
245
     * ----------------------------------- ISDAMAGEABLE -----------------------------------
246
     */
247

248
    @IntegrationTest
249
    public void testItemStackIsDamageable() throws EvaluationException {
250
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISDAMAGEABLE.evaluate(new IVariable[]{iApple});
×
251
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
252
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "isdamageable(apple) = false");
×
253

254
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISDAMAGEABLE.evaluate(new IVariable[]{iHoe});
×
255
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "isdamageable(hoe) = true");
×
256
    }
×
257

258
    @IntegrationTest(expected = EvaluationException.class)
259
    public void testInvalidInputIsDamageableIsDamageableLarge() throws EvaluationException {
260
        Operators.OBJECT_ITEMSTACK_ISDAMAGEABLE.evaluate(new IVariable[]{iApple, iApple});
×
261
    }
×
262

263
    @IntegrationTest(expected = EvaluationException.class)
264
    public void testInvalidInputIsDamageableIsDamageableSmall() throws EvaluationException {
265
        Operators.OBJECT_ITEMSTACK_ISDAMAGEABLE.evaluate(new IVariable[]{});
×
266
    }
×
267

268
    @IntegrationTest(expected = EvaluationException.class)
269
    public void testInvalidInputTypeIsDamageable() throws EvaluationException {
270
        Operators.OBJECT_ITEMSTACK_ISDAMAGEABLE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
271
    }
×
272

273
    /**
274
     * ----------------------------------- DAMAGE -----------------------------------
275
     */
276

277
    @IntegrationTest
278
    public void testItemStackDamage() throws EvaluationException {
279
        IValue res1 = Operators.OBJECT_ITEMSTACK_DAMAGE.evaluate(new IVariable[]{iHoe});
×
280
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
281
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 0, "damage(hoe:0) = 0");
×
282

283
        IValue res2 = Operators.OBJECT_ITEMSTACK_DAMAGE.evaluate(new IVariable[]{iHoe100});
×
284
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 100, "damage(hoe:100) = 100");
×
285
    }
×
286

287
    @IntegrationTest(expected = EvaluationException.class)
288
    public void testInvalidInputDamageDamageLarge() throws EvaluationException {
289
        Operators.OBJECT_ITEMSTACK_DAMAGE.evaluate(new IVariable[]{iApple, iApple});
×
290
    }
×
291

292
    @IntegrationTest(expected = EvaluationException.class)
293
    public void testInvalidInputDamageDamageSmall() throws EvaluationException {
294
        Operators.OBJECT_ITEMSTACK_DAMAGE.evaluate(new IVariable[]{});
×
295
    }
×
296

297
    @IntegrationTest(expected = EvaluationException.class)
298
    public void testInvalidInputTypeDamage() throws EvaluationException {
299
        Operators.OBJECT_ITEMSTACK_DAMAGE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
300
    }
×
301

302
    /**
303
     * ----------------------------------- MAXDAMAGE -----------------------------------
304
     */
305

306
    @IntegrationTest
307
    public void testItemStackMaxDamage() throws EvaluationException {
308
        IValue res1 = Operators.OBJECT_ITEMSTACK_MAXDAMAGE.evaluate(new IVariable[]{iApple});
×
309
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
310
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 0, "maxdamage(apple) = 0");
×
311

312
        IValue res2 = Operators.OBJECT_ITEMSTACK_MAXDAMAGE.evaluate(new IVariable[]{iHoe});
×
313
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 1561, "maxdamage(hoe) = 1561");
×
314
    }
×
315

316
    @IntegrationTest(expected = EvaluationException.class)
317
    public void testInvalidInputMaxDamageMaxDamageLarge() throws EvaluationException {
318
        Operators.OBJECT_ITEMSTACK_MAXDAMAGE.evaluate(new IVariable[]{iApple, iApple});
×
319
    }
×
320

321
    @IntegrationTest(expected = EvaluationException.class)
322
    public void testInvalidInputMaxDamageMaxDamageSmall() throws EvaluationException {
323
        Operators.OBJECT_ITEMSTACK_MAXDAMAGE.evaluate(new IVariable[]{});
×
324
    }
×
325

326
    @IntegrationTest(expected = EvaluationException.class)
327
    public void testInvalidInputTypeMaxDamage() throws EvaluationException {
328
        Operators.OBJECT_ITEMSTACK_MAXDAMAGE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
329
    }
×
330

331
    /**
332
     * ----------------------------------- ISENCHANTED -----------------------------------
333
     */
334

335
    @IntegrationTest
336
    public void testItemStackIsEnchanted() throws EvaluationException {
337
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISENCHANTED.evaluate(new IVariable[]{iHoe});
×
338
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
339
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "isenchanted(hoe) = false");
×
340

341
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISENCHANTED.evaluate(new IVariable[]{iHoeEnchanted});
×
342
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "isenchanted(hoeenchanted) = true");
×
343
    }
×
344

345
    @IntegrationTest(expected = EvaluationException.class)
346
    public void testInvalidInputIsEnchantedIsEnchantedLarge() throws EvaluationException {
347
        Operators.OBJECT_ITEMSTACK_ISENCHANTED.evaluate(new IVariable[]{iApple, iApple});
×
348
    }
×
349

350
    @IntegrationTest(expected = EvaluationException.class)
351
    public void testInvalidInputIsEnchantedIsEnchantedSmall() throws EvaluationException {
352
        Operators.OBJECT_ITEMSTACK_ISENCHANTED.evaluate(new IVariable[]{});
×
353
    }
×
354

355
    @IntegrationTest(expected = EvaluationException.class)
356
    public void testInvalidInputTypeIsEnchanted() throws EvaluationException {
357
        Operators.OBJECT_ITEMSTACK_ISENCHANTED.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
358
    }
×
359

360
    /**
361
     * ----------------------------------- ISENCHANTABLE -----------------------------------
362
     */
363

364
    @IntegrationTest
365
    public void testItemStackIsEnchantable() throws EvaluationException {
366
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISENCHANTABLE.evaluate(new IVariable[]{iApple});
×
367
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
368
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "isenchantable(apple) = false");
×
369

370
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISENCHANTABLE.evaluate(new IVariable[]{iHoe});
×
371
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "isenchantable(hoe) = true");
×
372
    }
×
373

374
    @IntegrationTest(expected = EvaluationException.class)
375
    public void testInvalidInputIsEnchantableIsEnchantableLarge() throws EvaluationException {
376
        Operators.OBJECT_ITEMSTACK_ISENCHANTABLE.evaluate(new IVariable[]{iApple, iApple});
×
377
    }
×
378

379
    @IntegrationTest(expected = EvaluationException.class)
380
    public void testInvalidInputIsEnchantableIsEnchantableSmall() throws EvaluationException {
381
        Operators.OBJECT_ITEMSTACK_ISENCHANTABLE.evaluate(new IVariable[]{});
×
382
    }
×
383

384
    @IntegrationTest(expected = EvaluationException.class)
385
    public void testInvalidInputTypeIsEnchantable() throws EvaluationException {
386
        Operators.OBJECT_ITEMSTACK_ISENCHANTABLE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
387
    }
×
388

389

390
    /**
391
     * ----------------------------------- REPAIRCOST -----------------------------------
392
     */
393

394
    @IntegrationTest
395
    public void testItemStackRepairCost() throws EvaluationException {
396
        IValue res1 = Operators.OBJECT_ITEMSTACK_REPAIRCOST.evaluate(new IVariable[]{iApple});
×
397
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
398
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 0, "repaircost(apple) = 0");
×
399

400
        IValue res2 = Operators.OBJECT_ITEMSTACK_REPAIRCOST.evaluate(new IVariable[]{iHoeEnchanted});
×
401
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 10, "repaircost(hoe:10) = 10");
×
402
    }
×
403

404
    @IntegrationTest(expected = EvaluationException.class)
405
    public void testInvalidInputRepairCostRepairCostLarge() throws EvaluationException {
406
        Operators.OBJECT_ITEMSTACK_REPAIRCOST.evaluate(new IVariable[]{iApple, iApple});
×
407
    }
×
408

409
    @IntegrationTest(expected = EvaluationException.class)
410
    public void testInvalidInputRepairCostRepairCostSmall() throws EvaluationException {
411
        Operators.OBJECT_ITEMSTACK_REPAIRCOST.evaluate(new IVariable[]{});
×
412
    }
×
413

414
    @IntegrationTest(expected = EvaluationException.class)
415
    public void testInvalidInputTypeRepairCost() throws EvaluationException {
416
        Operators.OBJECT_ITEMSTACK_REPAIRCOST.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
417
    }
×
418

419
    /**
420
     * ----------------------------------- RARITY -----------------------------------
421
     */
422

423
    @IntegrationTest
424
    public void testItemStackRarity() throws EvaluationException {
425
        IValue res1 = Operators.OBJECT_ITEMSTACK_RARITY.evaluate(new IVariable[]{iApple});
×
426
        Asserts.check(res1 instanceof ValueTypeString.ValueString, "result is an integer");
×
427
        TestHelpers.assertEqual(((ValueTypeString.ValueString) res1).getRawValue(), Rarity.COMMON.name(), "rarity(apple) = common");
×
428

429
        IValue res2 = Operators.OBJECT_ITEMSTACK_RARITY.evaluate(new IVariable[]{iHoeEnchanted});
×
430
        TestHelpers.assertEqual(((ValueTypeString.ValueString) res2).getRawValue(), Rarity.RARE.name(), "rarity(hoeenchanted) = rare");
×
431
    }
×
432

433
    @IntegrationTest(expected = EvaluationException.class)
434
    public void testInvalidInputRarityRarityLarge() throws EvaluationException {
435
        Operators.OBJECT_ITEMSTACK_RARITY.evaluate(new IVariable[]{iApple, iApple});
×
436
    }
×
437

438
    @IntegrationTest(expected = EvaluationException.class)
439
    public void testInvalidInputRarityRaritySmall() throws EvaluationException {
440
        Operators.OBJECT_ITEMSTACK_RARITY.evaluate(new IVariable[]{});
×
441
    }
×
442

443
    @IntegrationTest(expected = EvaluationException.class)
444
    public void testInvalidInputTypeRarity() throws EvaluationException {
445
        Operators.OBJECT_ITEMSTACK_RARITY.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
446
    }
×
447

448
    /**
449
     * ----------------------------------- STRENGTH_VS_BLOCK -----------------------------------
450
     */
451

452
    @IntegrationTest
453
    public void testItemStackStrengthVsBlock() throws EvaluationException {
454
        IValue res1 = Operators.OBJECT_ITEMSTACK_STRENGTH_VS_BLOCK.evaluate(new IVariable[]{iHoe, bStone});
×
455
        Asserts.check(res1 instanceof ValueTypeDouble.ValueDouble, "result is a double");
×
456
        TestHelpers.assertEqual(((ValueTypeDouble.ValueDouble) res1).getRawValue(), 1.0D, "strengthvsblock(hoe, stone) = 1.0");
×
457

458
        IValue res2 = Operators.OBJECT_ITEMSTACK_STRENGTH_VS_BLOCK.evaluate(new IVariable[]{iPickaxe, bStone});
×
459
        TestHelpers.assertEqual(((ValueTypeDouble.ValueDouble) res2).getRawValue(), 8.0D, "strengthvsblock(pickaxe, stone) = 8.0");
×
460

461
        IValue res3 = Operators.OBJECT_ITEMSTACK_STRENGTH_VS_BLOCK.evaluate(new IVariable[]{iPickaxe, bObsidian});
×
462
        TestHelpers.assertEqual(((ValueTypeDouble.ValueDouble) res3).getRawValue(), 8.0D, "strengthvsblock(pickaxe, obsidian) = 8.0");
×
463
    }
×
464

465
    @IntegrationTest(expected = EvaluationException.class)
466
    public void testInvalidInputStrengthVsBlockStrengthVsBlockLarge() throws EvaluationException {
467
        Operators.OBJECT_ITEMSTACK_STRENGTH_VS_BLOCK.evaluate(new IVariable[]{iApple, iApple, iApple});
×
468
    }
×
469

470
    @IntegrationTest(expected = EvaluationException.class)
471
    public void testInvalidInputStrengthVsBlockStrengthVsBlockSmall() throws EvaluationException {
472
        Operators.OBJECT_ITEMSTACK_STRENGTH_VS_BLOCK.evaluate(new IVariable[]{iApple});
×
473
    }
×
474

475
    @IntegrationTest(expected = EvaluationException.class)
476
    public void testInvalidInputTypeStrengthVsBlock() throws EvaluationException {
477
        Operators.OBJECT_ITEMSTACK_STRENGTH_VS_BLOCK.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
478
    }
×
479

480
    /**
481
     * ----------------------------------- CAN_HARVEST_BLOCK -----------------------------------
482
     */
483

484
    @IntegrationTest
485
    public void testItemStackCanHarvestBlock() throws EvaluationException {
486
        IValue res1 = Operators.OBJECT_ITEMSTACK_CAN_HARVEST_BLOCK.evaluate(new IVariable[]{iHoe, bStone});
×
487
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
488
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "canharvestblock(hoe, stone) = false");
×
489

490
        IValue res2 = Operators.OBJECT_ITEMSTACK_CAN_HARVEST_BLOCK.evaluate(new IVariable[]{iPickaxe, bStone});
×
491
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "canharvestblock(pickaxe, stone) = true");
×
492

493
        IValue res3 = Operators.OBJECT_ITEMSTACK_CAN_HARVEST_BLOCK.evaluate(new IVariable[]{iPickaxe, bObsidian});
×
494
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res3).getRawValue(), true, "canharvestblock(pickaxe, obsidian) = true");
×
495
    }
×
496

497
    @IntegrationTest(expected = EvaluationException.class)
498
    public void testInvalidInputCanHarvestBlockCanHarvestBlockLarge() throws EvaluationException {
499
        Operators.OBJECT_ITEMSTACK_CAN_HARVEST_BLOCK.evaluate(new IVariable[]{iApple, iApple, iApple});
×
500
    }
×
501

502
    @IntegrationTest(expected = EvaluationException.class)
503
    public void testInvalidInputCanHarvestBlockCanHarvestBlockSmall() throws EvaluationException {
504
        Operators.OBJECT_ITEMSTACK_CAN_HARVEST_BLOCK.evaluate(new IVariable[]{iApple});
×
505
    }
×
506

507
    @IntegrationTest(expected = EvaluationException.class)
508
    public void testInvalidInputTypeCanHarvestBlock() throws EvaluationException {
509
        Operators.OBJECT_ITEMSTACK_CAN_HARVEST_BLOCK.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
510
    }
×
511

512
    /**
513
     * ----------------------------------- BLOCK -----------------------------------
514
     */
515

516
    @IntegrationTest
517
    public void testItemStackBlock() throws EvaluationException {
518
        IValue res1 = Operators.OBJECT_ITEMSTACK_BLOCK.evaluate(new IVariable[]{iStone});
×
519
        Asserts.check(res1 instanceof ValueObjectTypeBlock.ValueBlock, "result is a block");
×
520
        TestHelpers.assertEqual(((ValueObjectTypeBlock.ValueBlock) res1).getRawValue().get(), Blocks.STONE.defaultBlockState(), "block(stone) = stone");
×
521

522
        IValue res2 = Operators.OBJECT_ITEMSTACK_BLOCK.evaluate(new IVariable[]{iDarkOakLeaves});
×
523
        TestHelpers.assertEqual(((ValueObjectTypeBlock.ValueBlock) res2).getRawValue().get(), Blocks.DARK_OAK_LEAVES.defaultBlockState()
×
524
                .setValue(LeavesBlock.DISTANCE, 7)
×
525
                .setValue(LeavesBlock.PERSISTENT, false), "block(dark_oak_leaves) = dark_oak_leaves");
×
526
    }
×
527

528
    @IntegrationTest(expected = EvaluationException.class)
529
    public void testInvalidInputBlockBlockLarge() throws EvaluationException {
530
        Operators.OBJECT_ITEMSTACK_BLOCK.evaluate(new IVariable[]{iApple, iApple});
×
531
    }
×
532

533
    @IntegrationTest(expected = EvaluationException.class)
534
    public void testInvalidInputBlockBlockSmall() throws EvaluationException {
535
        Operators.OBJECT_ITEMSTACK_BLOCK.evaluate(new IVariable[]{});
×
536
    }
×
537

538
    @IntegrationTest(expected = EvaluationException.class)
539
    public void testInvalidInputTypeBlock() throws EvaluationException {
540
        Operators.OBJECT_ITEMSTACK_BLOCK.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
541
    }
×
542

543
    /**
544
     * ----------------------------------- ISFLUIDSTACK -----------------------------------
545
     */
546

547
    @IntegrationTest
548
    public void testItemStackIsFluidStack() throws EvaluationException {
549
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISFLUIDSTACK.evaluate(new IVariable[]{iHoe});
×
550
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
551
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "isfluidstack(hoe) = false");
×
552

553
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISFLUIDSTACK.evaluate(new IVariable[]{iBucketLava});
×
554
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "isfluidstack(bucketlava) = true");
×
555
    }
×
556

557
    @IntegrationTest(expected = EvaluationException.class)
558
    public void testInvalidInputIsFluidStackIsFluidStackLarge() throws EvaluationException {
559
        Operators.OBJECT_ITEMSTACK_ISFLUIDSTACK.evaluate(new IVariable[]{iApple, iApple});
×
560
    }
×
561

562
    @IntegrationTest(expected = EvaluationException.class)
563
    public void testInvalidInputIsFluidStackIsFluidStackSmall() throws EvaluationException {
564
        Operators.OBJECT_ITEMSTACK_ISFLUIDSTACK.evaluate(new IVariable[]{});
×
565
    }
×
566

567
    @IntegrationTest(expected = EvaluationException.class)
568
    public void testInvalidInputTypeIsFluidStack() throws EvaluationException {
569
        Operators.OBJECT_ITEMSTACK_ISFLUIDSTACK.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
570
    }
×
571

572
    /**
573
     * ----------------------------------- FLUIDSTACK -----------------------------------
574
     */
575

576
    @IntegrationTest
577
    public void testItemStackFluidStack() throws EvaluationException {
578
        IValue res1 = Operators.OBJECT_ITEMSTACK_FLUIDSTACK.evaluate(new IVariable[]{iHoe});
×
579
        Asserts.check(res1 instanceof ValueObjectTypeFluidStack.ValueFluidStack, "result is a fluidstack");
×
580
        TestHelpers.assertEqual(((ValueObjectTypeFluidStack.ValueFluidStack) res1).getRawValue().isEmpty(), true, "fluidstack(hoe) = null");
×
581

582
        IValue res2 = Operators.OBJECT_ITEMSTACK_FLUIDSTACK.evaluate(new IVariable[]{iBucketLava});
×
583
        TestHelpers.assertEqual(FluidStack.matches(((ValueObjectTypeFluidStack.ValueFluidStack) res2).getRawValue(), new FluidStack(Fluids.LAVA, IModHelpersNeoForge.get().getFluidHelpers().getBucketVolume())), true, "fluidstack(bucketlava) = lava:1000");
×
584

585
        IValue res3 = Operators.OBJECT_ITEMSTACK_FLUIDSTACK.evaluate(new IVariable[]{iEmpty});
×
586
        TestHelpers.assertEqual(FluidStack.matches(((ValueObjectTypeFluidStack.ValueFluidStack) res3).getRawValue(), FluidStack.EMPTY), true, "fluidstack(empty) = empty");
×
587
    }
×
588

589
    @IntegrationTest(expected = EvaluationException.class)
590
    public void testInvalidInputFluidStackFluidStackLarge() throws EvaluationException {
591
        Operators.OBJECT_ITEMSTACK_FLUIDSTACK.evaluate(new IVariable[]{iApple, iApple});
×
592
    }
×
593

594
    @IntegrationTest(expected = EvaluationException.class)
595
    public void testInvalidInputFluidStackFluidStackSmall() throws EvaluationException {
596
        Operators.OBJECT_ITEMSTACK_FLUIDSTACK.evaluate(new IVariable[]{});
×
597
    }
×
598

599
    @IntegrationTest(expected = EvaluationException.class)
600
    public void testInvalidInputTypeFluidStack() throws EvaluationException {
601
        Operators.OBJECT_ITEMSTACK_FLUIDSTACK.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
602
    }
×
603

604
    /**
605
     * ----------------------------------- FLUIDSTACK_CAPACITY -----------------------------------
606
     */
607

608
    @IntegrationTest
609
    public void testItemStackFluidStackCapacity() throws EvaluationException {
610
        IValue res1 = Operators.OBJECT_ITEMSTACK_FLUIDSTACKCAPACITY.evaluate(new IVariable[]{iHoe});
×
611
        Asserts.check(res1 instanceof ValueTypeLong.ValueLong, "result is a fluidstack");
×
612
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res1).getRawValue(), 0L, "fluidstackcapacity(hoe) = 0");
×
613

614
        IValue res2 = Operators.OBJECT_ITEMSTACK_FLUIDSTACKCAPACITY.evaluate(new IVariable[]{iBucketLava});
×
615
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res2).getRawValue(), (long) IModHelpersNeoForge.get().getFluidHelpers().getBucketVolume(), "fluidstackcapacity(bucketlava) = 1000");
×
616
    }
×
617

618
    @IntegrationTest(expected = EvaluationException.class)
619
    public void testInvalidInputFluidStackCapacityFluidStackCapacityLarge() throws EvaluationException {
620
        Operators.OBJECT_ITEMSTACK_FLUIDSTACKCAPACITY.evaluate(new IVariable[]{iApple, iApple});
×
621
    }
×
622

623
    @IntegrationTest(expected = EvaluationException.class)
624
    public void testInvalidInputFluidStackCapacityFluidStackCapacitySmall() throws EvaluationException {
625
        Operators.OBJECT_ITEMSTACK_FLUIDSTACKCAPACITY.evaluate(new IVariable[]{});
×
626
    }
×
627

628
    @IntegrationTest(expected = EvaluationException.class)
629
    public void testInvalidInputTypeFluidStackCapacity() throws EvaluationException {
630
        Operators.OBJECT_ITEMSTACK_FLUIDSTACKCAPACITY.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
631
    }
×
632

633
    /**
634
     * ----------------------------------- ISNBTEQUAL -----------------------------------
635
     */
636

637
    @IntegrationTest
638
    public void testItemStackIsNBTEqual() throws EvaluationException {
639
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISDATAEQUAL.evaluate(new IVariable[]{iHoe, iPickaxe});
×
640
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
641
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "isnbtequal(hoe, pickaxe) = false");
×
642

643
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISDATAEQUAL.evaluate(new IVariable[]{iHoe, iHoeEnchanted});
×
644
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), false, "isnbtequal(hoe, hoeenchanted) = false");
×
645

646
        IValue res3 = Operators.OBJECT_ITEMSTACK_ISDATAEQUAL.evaluate(new IVariable[]{iPickaxe, iPickaxe});
×
647
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res3).getRawValue(), true, "isnbtequal(pickaxe, pickaxe) = true");
×
648
    }
×
649

650
    @IntegrationTest(expected = EvaluationException.class)
651
    public void testInvalidInputIsNBTEqualIsNBTEqualLarge() throws EvaluationException {
652
        Operators.OBJECT_ITEMSTACK_ISDATAEQUAL.evaluate(new IVariable[]{iApple, iApple, iApple});
×
653
    }
×
654

655
    @IntegrationTest(expected = EvaluationException.class)
656
    public void testInvalidInputIsNBTEqualIsNBTEqualSmall() throws EvaluationException {
657
        Operators.OBJECT_ITEMSTACK_ISDATAEQUAL.evaluate(new IVariable[]{iApple});
×
658
    }
×
659

660
    @IntegrationTest(expected = EvaluationException.class)
661
    public void testInvalidInputTypeIsNBTEqual() throws EvaluationException {
662
        Operators.OBJECT_ITEMSTACK_ISDATAEQUAL.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
663
    }
×
664

665
    /**
666
     * ----------------------------------- ISITEMEQUALNONBT -----------------------------------
667
     */
668

669
    @IntegrationTest
670
    public void testItemStackIsItemEqualNoNBT() throws EvaluationException {
671
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iHoe, iPickaxe});
×
672
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
673
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "israwitemequal(hoe, pickaxe) = false");
×
674

675
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iHoe, iHoeEnchanted});
×
676
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "israwitemequal(hoe, hoeenchanted) = true");
×
677

678
        IValue res3 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iPickaxe, iPickaxe});
×
679
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res3).getRawValue(), true, "israwitemequal(pickaxe, pickaxe) = true");
×
680
    }
×
681

682
    @IntegrationTest(expected = EvaluationException.class)
683
    public void testInvalidInputIsItemEqualNoNBTLarge() throws EvaluationException {
684
        Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iApple, iApple, iApple});
×
685
    }
×
686

687
    @IntegrationTest(expected = EvaluationException.class)
688
    public void testInvalidInputIsItemEqualNoNBTSmall() throws EvaluationException {
689
        Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iApple});
×
690
    }
×
691

692
    @IntegrationTest(expected = EvaluationException.class)
693
    public void testInvalidInputTypeIsItemEqualNoNBT() throws EvaluationException {
694
        Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
695
    }
×
696

697
    /**
698
     * ----------------------------------- ISRAWITEMEQUAL -----------------------------------
699
     */
700

701
    @IntegrationTest
702
    public void testItemStackIsRawItemEqual() throws EvaluationException {
703
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iHoe, iPickaxe});
×
704
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
705
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "israwitemequal(hoe, pickaxe) = false");
×
706

707
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iHoe, iHoeEnchanted});
×
708
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "israwitemequal(hoe, hoeenchanted) = true");
×
709

710
        IValue res3 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iPickaxe, iPickaxe});
×
711
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res3).getRawValue(), true, "israwitemequal(pickaxe, pickaxe) = true");
×
712

713
        IValue res4 = Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iHoe, iHoe100});
×
714
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res4).getRawValue(), true, "israwitemequal(hoe, hoe:100) = true");
×
715
    }
×
716

717
    @IntegrationTest(expected = EvaluationException.class)
718
    public void testInvalidInputIsRawItemEqualIsRawItemEqualLarge() throws EvaluationException {
719
        Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iApple, iApple, iApple});
×
720
    }
×
721

722
    @IntegrationTest(expected = EvaluationException.class)
723
    public void testInvalidInputIsRawItemEqualIsRawItemEqualSmall() throws EvaluationException {
724
        Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{iApple});
×
725
    }
×
726

727
    @IntegrationTest(expected = EvaluationException.class)
728
    public void testInvalidInputTypeIsRawItemEqual() throws EvaluationException {
729
        Operators.OBJECT_ITEMSTACK_ISRAWITEMEQUAL.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
730
    }
×
731

732
    /**
733
     * ----------------------------------- MODNAME -----------------------------------
734
     */
735

736
    @IntegrationTest
737
    public void testItemStackModName() throws EvaluationException {
738
        IValue res1 = Operators.OBJECT_ITEMSTACK_MODNAME.evaluate(new IVariable[]{iHoe});
×
739
        Asserts.check(res1 instanceof ValueTypeString.ValueString, "result is a string");
×
740
        TestHelpers.assertEqual(((ValueTypeString.ValueString) res1).getRawValue(), "Minecraft", "modname(hoe) = Minecraft");
×
741

742
        IValue res2 = Operators.OBJECT_ITEMSTACK_MODNAME.evaluate(new IVariable[]{iWrench});
×
743
        TestHelpers.assertEqual(((ValueTypeString.ValueString) res2).getRawValue(), "IntegratedDynamics", "modname(wrench) = IntegratedDynamics");
×
744
    }
×
745

746
    @IntegrationTest(expected = EvaluationException.class)
747
    public void testInvalidInputSizeModNameLarge() throws EvaluationException {
748
        Operators.OBJECT_ITEMSTACK_MODNAME.evaluate(new IVariable[]{iHoe, iHoe});
×
749
    }
×
750

751
    @IntegrationTest(expected = EvaluationException.class)
752
    public void testInvalidInputSizeModNameSmall() throws EvaluationException {
753
        Operators.OBJECT_ITEMSTACK_MODNAME.evaluate(new IVariable[]{});
×
754
    }
×
755

756
    @IntegrationTest(expected = EvaluationException.class)
757
    public void testInvalidInputTypeModName() throws EvaluationException {
758
        Operators.OBJECT_ITEMSTACK_MODNAME.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
759
    }
×
760

761
    /**
762
     * ----------------------------------- FUELBURNTIME -----------------------------------
763
     */
764

765
    @IntegrationTest
766
    public void testItemStackFuelBurnTime() throws EvaluationException {
767
        IValue res1 = Operators.OBJECT_ITEMSTACK_FUELBURNTIME.evaluate(new IVariable[]{iBucketLava});
×
768
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
769
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 20000, "fuelburntime(bucketlava) = 20000");
×
770

771
        IValue res2 = Operators.OBJECT_ITEMSTACK_FUELBURNTIME.evaluate(new IVariable[]{iApple});
×
772
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 0, "fuelburntime(apple) = 0");
×
773
    }
×
774

775
    @IntegrationTest(expected = EvaluationException.class)
776
    public void testInvalidInputFuelBurnTimeFuelBurnTimeLarge() throws EvaluationException {
777
        Operators.OBJECT_ITEMSTACK_FUELBURNTIME.evaluate(new IVariable[]{iApple, iApple});
×
778
    }
×
779

780
    @IntegrationTest(expected = EvaluationException.class)
781
    public void testInvalidInputFuelBurnTimeFuelBurnTimeSmall() throws EvaluationException {
782
        Operators.OBJECT_ITEMSTACK_FUELBURNTIME.evaluate(new IVariable[]{});
×
783
    }
×
784

785
    @IntegrationTest(expected = EvaluationException.class)
786
    public void testInvalidInputTypeFuelBurnTime() throws EvaluationException {
787
        Operators.OBJECT_ITEMSTACK_FUELBURNTIME.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
788
    }
×
789

790
    /**
791
     * ----------------------------------- CANBURN -----------------------------------
792
     */
793

794
    @IntegrationTest
795
    public void testItemStackCanBurn() throws EvaluationException {
796
        IValue res1 = Operators.OBJECT_ITEMSTACK_CANBURN.evaluate(new IVariable[]{iBucketLava});
×
797
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
798
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), true, "canburn(bucketlava) = true");
×
799

800
        IValue res2 = Operators.OBJECT_ITEMSTACK_CANBURN.evaluate(new IVariable[]{iApple});
×
801
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), false, "canburn(apple) = false");
×
802
    }
×
803

804
    @IntegrationTest(expected = EvaluationException.class)
805
    public void testInvalidInputCanBurnCanBurnLarge() throws EvaluationException {
806
        Operators.OBJECT_ITEMSTACK_CANBURN.evaluate(new IVariable[]{iApple, iApple});
×
807
    }
×
808

809
    @IntegrationTest(expected = EvaluationException.class)
810
    public void testInvalidInputCanBurnCanBurnSmall() throws EvaluationException {
811
        Operators.OBJECT_ITEMSTACK_CANBURN.evaluate(new IVariable[]{});
×
812
    }
×
813

814
    @IntegrationTest(expected = EvaluationException.class)
815
    public void testInvalidInputTypeCanBurn() throws EvaluationException {
816
        Operators.OBJECT_ITEMSTACK_CANBURN.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
817
    }
×
818

819
    /**
820
     * ----------------------------------- TAG -----------------------------------
821
     */
822

823
    @IntegrationTest
824
    public void testItemStackTag() throws EvaluationException {
825
        IValue res1 = Operators.OBJECT_ITEMSTACK_TAG.evaluate(new IVariable[]{iStone});
×
826
        Asserts.check(res1 instanceof ValueTypeList.ValueList, "result is a list");
×
827
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res1).getRawValue().getLength(), 2, "size(tag(stone)) = 2");
×
828

829
        IValue res2 = Operators.OBJECT_ITEMSTACK_TAG.evaluate(new IVariable[]{iWrench});
×
830
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res2).getRawValue().getLength(), 2, "size(tag(wrench)) = 2");
×
831
    }
×
832

833
    @IntegrationTest(expected = EvaluationException.class)
834
    public void testInvalidInputSizeTagLarge() throws EvaluationException {
835
        Operators.OBJECT_ITEMSTACK_TAG.evaluate(new IVariable[]{iHoe, iHoe});
×
836
    }
×
837

838
    @IntegrationTest(expected = EvaluationException.class)
839
    public void testInvalidInputSizeTagSmall() throws EvaluationException {
840
        Operators.OBJECT_ITEMSTACK_TAG.evaluate(new IVariable[]{});
×
841
    }
×
842

843
    @IntegrationTest(expected = EvaluationException.class)
844
    public void testInvalidInputTypeTag() throws EvaluationException {
845
        Operators.OBJECT_ITEMSTACK_TAG.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
846
    }
×
847

848
    /**
849
     * ----------------------------------- TAG_STACKS -----------------------------------
850
     */
851

852
    @IntegrationTest
853
    public void testItemStackTagStacks() throws EvaluationException {
854
        IValue res1 = Operators.OBJECT_ITEMSTACK_TAG_STACKS.evaluate(new IVariable[]{sPlankWood});
×
855
        Asserts.check(res1 instanceof ValueTypeList.ValueList, "result is a list");
×
856
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res1).getRawValue().getLength(), (int)Helpers.getTagValues("minecraft:planks").count(), "size(tag_stacks(plankWood))");
×
857
    }
×
858

859
    @IntegrationTest(expected = EvaluationException.class)
860
    public void testInvalidInputSizeTagStacksLarge() throws EvaluationException {
861
        Operators.OBJECT_ITEMSTACK_TAG_STACKS.evaluate(new IVariable[]{sPlankWood, sPlankWood});
×
862
    }
×
863

864
    @IntegrationTest(expected = EvaluationException.class)
865
    public void testInvalidInputSizeTagStacksSmall() throws EvaluationException {
866
        Operators.OBJECT_ITEMSTACK_TAG_STACKS.evaluate(new IVariable[]{});
×
867
    }
×
868

869
    @IntegrationTest(expected = EvaluationException.class)
870
    public void testInvalidInputTypeTagStacks() throws EvaluationException {
871
        Operators.OBJECT_ITEMSTACK_TAG_STACKS.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
872
    }
×
873

874
    /**
875
     * ----------------------------------- WITHSIZE -----------------------------------
876
     */
877

878
    @IntegrationTest
879
    public void testItemStackWithSize() throws EvaluationException {
880
        IValue res1 = Operators.OBJECT_ITEMSTACK_WITHSIZE.evaluate(new IVariable[]{iApple, int100});
×
881
        Asserts.check(res1 instanceof ValueObjectTypeItemStack.ValueItemStack, "result is an itemstack");
×
882
        TestHelpers.assertEqual(((ValueObjectTypeItemStack.ValueItemStack) res1).getRawValue().getCount(), 100, "withsize(apple, 100).stacksize == 100");
×
883

884
        IValue res2 = Operators.OBJECT_ITEMSTACK_WITHSIZE.evaluate(new IVariable[]{iBeef, int200});
×
885
        TestHelpers.assertEqual(((ValueObjectTypeItemStack.ValueItemStack) res2).getRawValue().getCount(), 200, "withsize(beef, 200).stacksize == 200");
×
886
    }
×
887

888
    @IntegrationTest(expected = EvaluationException.class)
889
    public void testInvalidInputSizeWithSizeLarge() throws EvaluationException {
890
        Operators.OBJECT_ITEMSTACK_WITHSIZE.evaluate(new IVariable[]{iApple, int100, int100});
×
891
    }
×
892

893
    @IntegrationTest(expected = EvaluationException.class)
894
    public void testInvalidInputSizeWithSizeSmall() throws EvaluationException {
895
        Operators.OBJECT_ITEMSTACK_WITHSIZE.evaluate(new IVariable[]{iApple});
×
896
    }
×
897

898
    @IntegrationTest(expected = EvaluationException.class)
899
    public void testInvalidInputTypeWithSize() throws EvaluationException {
900
        Operators.OBJECT_ITEMSTACK_WITHSIZE.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
901
    }
×
902

903
    /**
904
     * ----------------------------------- ISFECONTAINER -----------------------------------
905
     */
906

907
    @IntegrationTest
908
    public void testItemStackIsFeContainer() throws EvaluationException {
909
        IValue res1 = Operators.OBJECT_ITEMSTACK_ISENERGYCONTAINER.evaluate(new IVariable[]{iApple});
×
910
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
911
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "isfecontainer(apple) == false");
×
912

913
        IValue res2 = Operators.OBJECT_ITEMSTACK_ISENERGYCONTAINER.evaluate(new IVariable[]{iEnergyBatteryEmpty});
×
914
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "isfecontainer(energyBatteryEmpty) == true");
×
915

916
        IValue res3 = Operators.OBJECT_ITEMSTACK_ISENERGYCONTAINER.evaluate(new IVariable[]{iEnergyBatteryFull});
×
917
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res3).getRawValue(), true, "isfecontainer(energyBatteryFull) == true");
×
918
    }
×
919

920
    @IntegrationTest(expected = EvaluationException.class)
921
    public void testInvalidInputSizeIsFeContainerLarge() throws EvaluationException {
922
        Operators.OBJECT_ITEMSTACK_ISENERGYCONTAINER.evaluate(new IVariable[]{iApple, iApple});
×
923
    }
×
924

925
    @IntegrationTest(expected = EvaluationException.class)
926
    public void testInvalidInputSizeIsFeContainerSmall() throws EvaluationException {
927
        Operators.OBJECT_ITEMSTACK_ISENERGYCONTAINER.evaluate(new IVariable[]{});
×
928
    }
×
929

930
    @IntegrationTest(expected = EvaluationException.class)
931
    public void testInvalidInputTypeIsFeContainer() throws EvaluationException {
932
        Operators.OBJECT_ITEMSTACK_ISENERGYCONTAINER.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
933
    }
×
934

935
    /**
936
     * ----------------------------------- STOREDFE -----------------------------------
937
     */
938

939
    @IntegrationTest
940
    public void testItemStackStoredFe() throws EvaluationException {
941
        IValue res1 = Operators.OBJECT_ITEMSTACK_STOREDENERGY.evaluate(new IVariable[]{iApple});
×
942
        Asserts.check(res1 instanceof ValueTypeLong.ValueLong, "result is a long");
×
943
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res1).getRawValue(), 0L, "storedfe(apple) == false");
×
944

945
        IValue res2 = Operators.OBJECT_ITEMSTACK_STOREDENERGY.evaluate(new IVariable[]{iEnergyBatteryEmpty});
×
946
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res2).getRawValue(), 0L, "storedfe(energyBatteryEmpty) == 0");
×
947

948
        IValue res3 = Operators.OBJECT_ITEMSTACK_STOREDENERGY.evaluate(new IVariable[]{iEnergyBatteryFull});
×
949
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res3).getRawValue(), (long) BlockEnergyBatteryConfig.capacity, "storedfe(energyBatteryFull) == BlockEnergyBatteryConfig.capacity");
×
950
    }
×
951

952
    @IntegrationTest(expected = EvaluationException.class)
953
    public void testInvalidInputSizeStoredFeLarge() throws EvaluationException {
954
        Operators.OBJECT_ITEMSTACK_STOREDENERGY.evaluate(new IVariable[]{iEnergyBatteryEmpty, iEnergyBatteryEmpty});
×
955
    }
×
956

957
    @IntegrationTest(expected = EvaluationException.class)
958
    public void testInvalidInputSizeStoredFeSmall() throws EvaluationException {
959
        Operators.OBJECT_ITEMSTACK_STOREDENERGY.evaluate(new IVariable[]{});
×
960
    }
×
961

962
    @IntegrationTest(expected = EvaluationException.class)
963
    public void testInvalidInputTypeStoredFe() throws EvaluationException {
964
        Operators.OBJECT_ITEMSTACK_STOREDENERGY.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
965
    }
×
966

967
    /**
968
     * ----------------------------------- FECAPACITY -----------------------------------
969
     */
970

971
    @IntegrationTest
972
    public void testItemStackFeCapacity() throws EvaluationException {
973
        IValue res1 = Operators.OBJECT_ITEMSTACK_ENERGYCAPACITY.evaluate(new IVariable[]{iApple});
×
974
        Asserts.check(res1 instanceof ValueTypeLong.ValueLong, "result is an integer");
×
975
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res1).getRawValue(), 0L, "fecapacity(apple) == false");
×
976

977
        IValue res2 = Operators.OBJECT_ITEMSTACK_ENERGYCAPACITY.evaluate(new IVariable[]{iEnergyBatteryEmpty});
×
978
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res2).getRawValue(), (long) BlockEnergyBatteryConfig.capacity, "fecapacity(energyBatteryEmpty) == BlockEnergyBatteryConfig.capacity");
×
979

980
        IValue res3 = Operators.OBJECT_ITEMSTACK_ENERGYCAPACITY.evaluate(new IVariable[]{iEnergyBatteryFull});
×
981
        TestHelpers.assertEqual(((ValueTypeLong.ValueLong) res3).getRawValue(), (long) BlockEnergyBatteryConfig.capacity, "fecapacity(energyBatteryFull) == BlockEnergyBatteryConfig.capacity");
×
982
    }
×
983

984
    @IntegrationTest(expected = EvaluationException.class)
985
    public void testInvalidInputSizeFeCapacityLarge() throws EvaluationException {
986
        Operators.OBJECT_ITEMSTACK_ENERGYCAPACITY.evaluate(new IVariable[]{iEnergyBatteryEmpty, iEnergyBatteryEmpty});
×
987
    }
×
988

989
    @IntegrationTest(expected = EvaluationException.class)
990
    public void testInvalidInputSizeFeCapacitySmall() throws EvaluationException {
991
        Operators.OBJECT_ITEMSTACK_ENERGYCAPACITY.evaluate(new IVariable[]{});
×
992
    }
×
993

994
    @IntegrationTest(expected = EvaluationException.class)
995
    public void testInvalidInputTypeFeCapacity() throws EvaluationException {
996
        Operators.OBJECT_ITEMSTACK_ENERGYCAPACITY.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
997
    }
×
998

999
    /**
1000
     * ----------------------------------- HASINVENTORY -----------------------------------
1001
     */
1002

1003
    @IntegrationTest
1004
    public void testItemStackHasInventory() throws EvaluationException {
1005
        IValue res1 = Operators.OBJECT_ITEMSTACK_HASINVENTORY.evaluate(new IVariable[]{iApple});
×
1006
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
1007
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "hasinventory(apple) == false");
×
1008

1009
        IValue res2 = Operators.OBJECT_ITEMSTACK_HASINVENTORY.evaluate(new IVariable[]{iShulkerBox});
×
1010
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "hasinventory(shulkerbox) == true");
×
1011
    }
×
1012

1013
    @IntegrationTest(expected = EvaluationException.class)
1014
    public void testInvalidInputSizeHasInventoryLarge() throws EvaluationException {
1015
        Operators.OBJECT_ITEMSTACK_HASINVENTORY.evaluate(new IVariable[]{iApple, int100});
×
1016
    }
×
1017

1018
    @IntegrationTest(expected = EvaluationException.class)
1019
    public void testInvalidInputSizeHasInventorySmall() throws EvaluationException {
1020
        Operators.OBJECT_ITEMSTACK_HASINVENTORY.evaluate(new IVariable[]{});
×
1021
    }
×
1022

1023
    @IntegrationTest(expected = EvaluationException.class)
1024
    public void testInvalidInputTypeHasInventory() throws EvaluationException {
1025
        Operators.OBJECT_ITEMSTACK_HASINVENTORY.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1026
    }
×
1027

1028
    /**
1029
     * ----------------------------------- INVENTORYSIZE -----------------------------------
1030
     */
1031

1032
    @IntegrationTest
1033
    public void testItemStackInventorySize() throws EvaluationException {
1034
        IValue res1 = Operators.OBJECT_ITEMSTACK_INVENTORYSIZE.evaluate(new IVariable[]{iApple});
×
1035
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is a boolean");
×
1036
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 0, "inventorysize(apple) == 0");
×
1037

1038
        IValue res2 = Operators.OBJECT_ITEMSTACK_INVENTORYSIZE.evaluate(new IVariable[]{iShulkerBox});
×
1039
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 27, "inventory(shulkerbox) == 27");
×
1040
    }
×
1041

1042
    @IntegrationTest(expected = EvaluationException.class)
1043
    public void testInvalidInputSizeInventorySizeLarge() throws EvaluationException {
1044
        Operators.OBJECT_ITEMSTACK_INVENTORYSIZE.evaluate(new IVariable[]{iApple, int100});
×
1045
    }
×
1046

1047
    @IntegrationTest(expected = EvaluationException.class)
1048
    public void testInvalidInputSizeInventorySizeSmall() throws EvaluationException {
1049
        Operators.OBJECT_ITEMSTACK_INVENTORYSIZE.evaluate(new IVariable[]{});
×
1050
    }
×
1051

1052
    @IntegrationTest(expected = EvaluationException.class)
1053
    public void testInvalidInputTypeInventorySize() throws EvaluationException {
1054
        Operators.OBJECT_ITEMSTACK_INVENTORYSIZE.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1055
    }
×
1056

1057
    /**
1058
     * ----------------------------------- INVENTORY -----------------------------------
1059
     */
1060

1061
    @IntegrationTest
1062
    public void testItemStackInventory() throws EvaluationException {
1063
        IValue res1 = Operators.OBJECT_ITEMSTACK_INVENTORY.evaluate(new IVariable[]{iApple});
×
1064
        Asserts.check(res1 instanceof ValueTypeList.ValueList, "result is a list");
×
1065
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res1).getRawValue().getLength(), 0, "inventory(apple).size == 0");
×
1066

1067
        IValue res2 = Operators.OBJECT_ITEMSTACK_INVENTORY.evaluate(new IVariable[]{iShulkerBox});
×
1068
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res2).getRawValue().getLength(), 27, "inventory(shulkerbox).size == 27");
×
1069

1070
        IValue res3 = Operators.OBJECT_ITEMSTACK_INVENTORY.evaluate(new IVariable[]{iShulkerBox});
×
1071
        TestHelpers.assertEqual(((ValueObjectTypeItemStack.ValueItemStack) (((ValueTypeList.ValueList) res3).getRawValue().get(10))).getRawValue().getItem(), Items.APPLE, "inventory(shulkerbox)[10] == apple");
×
1072
    }
×
1073

1074
    @IntegrationTest(expected = EvaluationException.class)
1075
    public void testInvalidInputInventoryLarge() throws EvaluationException {
1076
        Operators.OBJECT_ITEMSTACK_INVENTORY.evaluate(new IVariable[]{iApple, int100});
×
1077
    }
×
1078

1079
    @IntegrationTest(expected = EvaluationException.class)
1080
    public void testInvalidInputInventorySmall() throws EvaluationException {
1081
        Operators.OBJECT_ITEMSTACK_INVENTORY.evaluate(new IVariable[]{});
×
1082
    }
×
1083

1084
    @IntegrationTest(expected = EvaluationException.class)
1085
    public void testInvalidInputTypeInventory() throws EvaluationException {
1086
        Operators.OBJECT_ITEMSTACK_INVENTORY.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1087
    }
×
1088

1089
    /**
1090
     * ----------------------------------- ITEMBYNAME -----------------------------------
1091
     */
1092

1093
    @IntegrationTest
1094
    public void testItemItemByName() throws EvaluationException {
1095
        IValue res1 = Operators.OBJECT_ITEMSTACK_BY_NAME.evaluate(new IVariable[]{sApple});
×
1096
        Asserts.check(res1 instanceof ValueObjectTypeItemStack.ValueItemStack, "result is a block");
×
1097
        TestHelpers.assertEqual(((ValueObjectTypeItemStack.ValueItemStack) res1).getRawValue().getItem(),
×
1098
                new ItemStack(Items.APPLE).getItem(), "itembyname(minecraft:apple) = apple");
×
1099
    }
×
1100

1101
    @IntegrationTest(expected = EvaluationException.class)
1102
    public void testInvalidInputSizeItemByNameLarge() throws EvaluationException {
1103
        Operators.OBJECT_ITEMSTACK_BY_NAME.evaluate(new IVariable[]{sApple, sApple});
×
1104
    }
×
1105

1106
    @IntegrationTest(expected = EvaluationException.class)
1107
    public void testInvalidInputSizeItemByNameSmall() throws EvaluationException {
1108
        Operators.OBJECT_ITEMSTACK_BY_NAME.evaluate(new IVariable[]{});
×
1109
    }
×
1110

1111
    @IntegrationTest(expected = EvaluationException.class)
1112
    public void testInvalidInputTypeItemByName() throws EvaluationException {
1113
        Operators.OBJECT_ITEMSTACK_BY_NAME.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1114
    }
×
1115

1116
    /**
1117
     * ----------------------------------- LIST_COUNT -----------------------------------
1118
     */
1119

1120
    @IntegrationTest
1121
    public void testItemStackListCount() throws EvaluationException {
1122
        IValue res1 = Operators.OBJECT_ITEMSTACK_LIST_COUNT.evaluate(new IVariable[]{lApples, iApple});
×
1123
        Asserts.check(res1 instanceof ValueTypeInteger.ValueInteger, "result is an integer");
×
1124
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res1).getRawValue(), 7, "listcount(apple) = 7");
×
1125

1126
        IValue res2 = Operators.OBJECT_ITEMSTACK_LIST_COUNT.evaluate(new IVariable[]{lApples, iStone});
×
1127
        TestHelpers.assertEqual(((ValueTypeInteger.ValueInteger) res2).getRawValue(), 0, "listcount(stone) = 0");
×
1128
    }
×
1129

1130
    @IntegrationTest(expected = EvaluationException.class)
1131
    public void testInvalidInputSizeListCountLarge() throws EvaluationException {
1132
        Operators.OBJECT_ITEMSTACK_LIST_COUNT.evaluate(new IVariable[]{lApples, iApple, iApple});
×
1133
    }
×
1134

1135
    @IntegrationTest(expected = EvaluationException.class)
1136
    public void testInvalidInputSizeListCountSmall() throws EvaluationException {
1137
        Operators.OBJECT_ITEMSTACK_LIST_COUNT.evaluate(new IVariable[]{lApples});
×
1138
    }
×
1139

1140
    @IntegrationTest(expected = EvaluationException.class)
1141
    public void testInvalidInputTypeListCount() throws EvaluationException {
1142
        Operators.OBJECT_ITEMSTACK_LIST_COUNT.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
1143
    }
×
1144

1145
    /**
1146
     * ----------------------------------- DATA -----------------------------------
1147
     */
1148

1149
    @IntegrationTest
1150
    public void testItemStackNbt() throws EvaluationException {
1151
        IValue res1 = Operators.OBJECT_ITEMSTACK_DATA.evaluate(new IVariable[]{iAppleNoData});
×
1152
        Asserts.check(res1 instanceof ValueTypeNbt.ValueNbt, "result is an nbt tag");
×
1153
        TestHelpers.assertEqual(((ValueTypeNbt.ValueNbt) res1).getRawValue().isPresent(), false, "data(apple:1) is null");
×
1154

1155
        IValue res2 = Operators.OBJECT_ITEMSTACK_DATA.evaluate(new IVariable[]{iEnergyBatteryFull});
×
1156
        TestHelpers.assertNonEqual(((ValueTypeNbt.ValueNbt) res2).getRawValue().get(), new CompoundTag(), "data(battery) is non null");
×
1157
    }
×
1158

1159
    @IntegrationTest(expected = EvaluationException.class)
1160
    public void testInvalidInputNbtNbtLarge() throws EvaluationException {
1161
        Operators.OBJECT_ITEMSTACK_DATA.evaluate(new IVariable[]{iApple, iApple});
×
1162
    }
×
1163

1164
    @IntegrationTest(expected = EvaluationException.class)
1165
    public void testInvalidInputNbtNbtSmall() throws EvaluationException {
1166
        Operators.OBJECT_ITEMSTACK_DATA.evaluate(new IVariable[]{});
×
1167
    }
×
1168

1169
    @IntegrationTest(expected = EvaluationException.class)
1170
    public void testInvalidInputTypeNbt() throws EvaluationException {
1171
        Operators.OBJECT_ITEMSTACK_DATA.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1172
    }
×
1173

1174
    /**
1175
     * ----------------------------------- HASDATA -----------------------------------
1176
     */
1177

1178
    @IntegrationTest
1179
    public void testItemStackHasNbt() throws EvaluationException {
1180
        IValue res1 = Operators.OBJECT_ITEMSTACK_HASDATA.evaluate(new IVariable[]{iEmpty});
×
1181
        Asserts.check(res1 instanceof ValueTypeBoolean.ValueBoolean, "result is a boolean");
×
1182
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res1).getRawValue(), false, "hasdata(empty) = false");
×
1183

1184
        IValue res2 = Operators.OBJECT_ITEMSTACK_HASDATA.evaluate(new IVariable[]{iAppleTag});
×
1185
        TestHelpers.assertEqual(((ValueTypeBoolean.ValueBoolean) res2).getRawValue(), true, "hasdata(appleTag) = true");
×
1186
    }
×
1187

1188
    @IntegrationTest(expected = EvaluationException.class)
1189
    public void testInvalidInputHasNbtHasNbtLarge() throws EvaluationException {
1190
        Operators.OBJECT_ITEMSTACK_HASDATA.evaluate(new IVariable[]{iApple, iApple});
×
1191
    }
×
1192

1193
    @IntegrationTest(expected = EvaluationException.class)
1194
    public void testInvalidInputHasNbtHasNbtSmall() throws EvaluationException {
1195
        Operators.OBJECT_ITEMSTACK_HASDATA.evaluate(new IVariable[]{});
×
1196
    }
×
1197

1198
    @IntegrationTest(expected = EvaluationException.class)
1199
    public void testInvalidInputTypeHasNbt() throws EvaluationException {
1200
        Operators.OBJECT_ITEMSTACK_HASDATA.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1201
    }
×
1202

1203
    /**
1204
     * ----------------------------------- DATA_KEYS -----------------------------------
1205
     */
1206

1207
    @IntegrationTest
1208
    public void testItemStackDataKeys() throws EvaluationException {
1209
        IValue res1 = Operators.OBJECT_ITEMSTACK_DATA_KEYS.evaluate(new IVariable[]{iEmpty});
×
1210
        Asserts.check(res1 instanceof ValueTypeList.ValueList<?,?>, "result is a list");
×
1211
        TestHelpers.assertEqual(((ValueTypeList.ValueList<?,?>) res1).getRawValue().getLength(), 0, "datakeys(empty) = []");
×
1212

1213
        IValue res2 = Operators.OBJECT_ITEMSTACK_DATA_KEYS.evaluate(new IVariable[]{iAppleTag});
×
1214
        TestHelpers.assertEqual(((ValueTypeList.ValueList<?,?>) res2).getRawValue().getLength(), 13, "datakeys(appleTag).length = 13");
×
1215
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(0))).getRawValue(), "minecraft:attribute_modifiers", "datakeys(appleTag)[0] == ...");
×
1216
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(1))).getRawValue(), "minecraft:break_sound", "datakeys(appleTag)[1] == ...");
×
1217
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(2))).getRawValue(), "minecraft:consumable", "datakeys(appleTag)[2] == ...");
×
1218
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(3))).getRawValue(), "minecraft:enchantments", "datakeys(appleTag)[3] == ...");
×
1219
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(4))).getRawValue(), "minecraft:food", "datakeys(appleTag)[4] == ...");
×
1220
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(5))).getRawValue(), "minecraft:item_model", "datakeys(appleTag)[5] == ...");
×
1221
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(6))).getRawValue(), "minecraft:item_name", "datakeys(appleTag)[6] == ...");
×
1222
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(7))).getRawValue(), "minecraft:lore", "datakeys(appleTag)[7] == ...");
×
1223
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(8))).getRawValue(), "minecraft:max_stack_size", "datakeys(appleTag)[8] == ...");
×
1224
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(9))).getRawValue(), "minecraft:ominous_bottle_amplifier", "datakeys(appleTag)[9] == ...");
×
1225
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(10))).getRawValue(), "minecraft:rarity", "datakeys(appleTag)[10] == ...");
×
1226
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(11))).getRawValue(), "minecraft:repair_cost", "datakeys(appleTag)[11] == ...");
×
1227
        TestHelpers.assertEqual(((ValueTypeString.ValueString) (((ValueTypeList.ValueList) res2).getRawValue().get(12))).getRawValue(), "minecraft:tooltip_display", "datakeys(appleTag)[12] == ...");
×
1228
    }
×
1229

1230
    @IntegrationTest(expected = EvaluationException.class)
1231
    public void testInvalidInputDataKeysDataKeysLarge() throws EvaluationException {
1232
        Operators.OBJECT_ITEMSTACK_DATA_KEYS.evaluate(new IVariable[]{iApple, iApple});
×
1233
    }
×
1234

1235
    @IntegrationTest(expected = EvaluationException.class)
1236
    public void testInvalidInputDataKeysDataKeysSmall() throws EvaluationException {
1237
        Operators.OBJECT_ITEMSTACK_DATA_KEYS.evaluate(new IVariable[]{});
×
1238
    }
×
1239

1240
    @IntegrationTest(expected = EvaluationException.class)
1241
    public void testInvalidInputTypeDataKeys() throws EvaluationException {
1242
        Operators.OBJECT_ITEMSTACK_DATA_KEYS.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1243
    }
×
1244

1245
    /**
1246
     * ----------------------------------- DATA_VALUE -----------------------------------
1247
     */
1248

1249
    @IntegrationTest
1250
    public void testItemStackDataValue() throws EvaluationException {
1251
        IValue res1 = Operators.OBJECT_ITEMSTACK_DATA_VALUE.evaluate(new IVariable[]{iAppleNoData, sMaxStackSize});
×
1252
        Asserts.check(res1 instanceof ValueTypeNbt.ValueNbt, "result is an empty tag");
×
1253
        TestHelpers.assertEqual(((ValueTypeNbt.ValueNbt) res1).getRawValue().isEmpty(), true, "datavalue(apple, maxstacksize) = empty");
×
1254

1255
        IValue res2 = Operators.OBJECT_ITEMSTACK_DATA_VALUE.evaluate(new IVariable[]{iAppleTag, sMaxStackSize});
×
1256
        TestHelpers.assertEqual(((ValueTypeNbt.ValueNbt) res2).getRawValue().get(), IntTag.valueOf(64), "datavalue(appleTag, maxstacksize).length = 64");
×
1257
    }
×
1258

1259
    @IntegrationTest(expected = EvaluationException.class)
1260
    public void testInvalidInputDataValueDataValueLarge() throws EvaluationException {
1261
        Operators.OBJECT_ITEMSTACK_DATA_VALUE.evaluate(new IVariable[]{iApple, sMaxStackSize, iApple});
×
1262
    }
×
1263

1264
    @IntegrationTest(expected = EvaluationException.class)
1265
    public void testInvalidInputDataValueDataValueSmall() throws EvaluationException {
1266
        Operators.OBJECT_ITEMSTACK_DATA_VALUE.evaluate(new IVariable[]{iApple});
×
1267
    }
×
1268

1269
    @IntegrationTest(expected = EvaluationException.class)
1270
    public void testInvalidInputTypeDataValue() throws EvaluationException {
1271
        Operators.OBJECT_ITEMSTACK_DATA_VALUE.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE});
×
1272
    }
×
1273

1274
    /**
1275
     * ----------------------------------- WITH_DATA -----------------------------------
1276
     */
1277

1278
    @IntegrationTest
1279
    public void testItemStackWithData() throws EvaluationException {
1280
        IValue res1 = Operators.OBJECT_ITEMSTACK_WITH_DATA.evaluate(new IVariable[]{iAppleNoData, sMaxStackSize, t4});
×
1281
        Asserts.check(res1 instanceof ValueObjectTypeItemStack.ValueItemStack, "result is an item");
×
1282
        ItemStack outItem1 = ((ValueObjectTypeItemStack.ValueItemStack) res1).getRawValue();
×
1283
        TestHelpers.assertEqual(outItem1.getItem(), iAppleNoData.getValue().getRawValue().getItem(), "withdata(apple, maxstacksize, 4) = apple");
×
1284
        TestHelpers.assertNonEqual(outItem1.getComponents(), iAppleNoData.getValue().getRawValue().getComponents(), "withdata(apple, maxstacksize, 4) !=components apple");
×
1285
        TestHelpers.assertEqual(outItem1.get(DataComponents.MAX_STACK_SIZE), 4, "withdata(apple, maxstacksize, 4).maxstacksize = 4");
×
1286

1287
        IValue res2 = Operators.OBJECT_ITEMSTACK_WITH_DATA.evaluate(new IVariable[]{iAppleTag, sMaxStackSize, t4});
×
1288
        ItemStack outItem2 = ((ValueObjectTypeItemStack.ValueItemStack) res2).getRawValue();
×
1289
        TestHelpers.assertEqual(outItem2.getItem(), iAppleNoData.getValue().getRawValue().getItem(), "withdata(appleTag, maxstacksize, 4) = apple");
×
1290
        TestHelpers.assertNonEqual(outItem2.getComponents(), iAppleNoData.getValue().getRawValue().getComponents(), "withdata(appleTag, maxstacksize, 4) !=components apple");
×
1291
        TestHelpers.assertEqual(outItem2.get(DataComponents.MAX_STACK_SIZE), 4, "withdata(appleTag, maxstacksize, 4).maxstacksize = 4");
×
1292
    }
×
1293

1294
    @IntegrationTest(expected = EvaluationException.class)
1295
    public void testInvalidInputWithDataWithDataLarge() throws EvaluationException {
1296
        Operators.OBJECT_ITEMSTACK_WITH_DATA.evaluate(new IVariable[]{iApple, sMaxStackSize, t4, iApple});
×
1297
    }
×
1298

1299
    @IntegrationTest(expected = EvaluationException.class)
1300
    public void testInvalidInputWithDataWithDataSmall() throws EvaluationException {
1301
        Operators.OBJECT_ITEMSTACK_WITH_DATA.evaluate(new IVariable[]{iApple, sMaxStackSize});
×
1302
    }
×
1303

1304
    @IntegrationTest(expected = EvaluationException.class)
1305
    public void testInvalidInputTypeWithData() throws EvaluationException {
1306
        Operators.OBJECT_ITEMSTACK_WITH_DATA.evaluate(new IVariable[]{DUMMY_VARIABLE, DUMMY_VARIABLE, DUMMY_VARIABLE});
×
1307
    }
×
1308

1309
    /**
1310
     * ----------------------------------- TOOLTIPLINES -----------------------------------
1311
     */
1312

1313
    @IntegrationTest
1314
    public void testItemStackTooltip() throws EvaluationException {
1315
        IValue res1 = Operators.OBJECT_ITEMSTACK_TOOLTIP.evaluate(new IVariable[]{iPickaxe});
×
1316
        Asserts.check(res1 instanceof ValueTypeList.ValueList, "result is a list");
×
1317
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res1).getRawValue().getLength(), 5, "size(tooltip(pickaxe)) = 5");
×
1318

1319
        IValue res2 = Operators.OBJECT_ITEMSTACK_TOOLTIP.evaluate(new IVariable[]{iApple});
×
1320
        TestHelpers.assertEqual(((ValueTypeList.ValueList) res2).getRawValue().getLength(), 1, "size(tooltip(apple)) = 1");
×
1321
    }
×
1322

1323
    @IntegrationTest(expected = EvaluationException.class)
1324
    public void testInvalidInputSizeTooltipLarge() throws EvaluationException {
1325
        Operators.OBJECT_ITEMSTACK_TOOLTIP.evaluate(new IVariable[]{iPickaxe, iPickaxe});
×
1326
    }
×
1327

1328
    @IntegrationTest(expected = EvaluationException.class)
1329
    public void testInvalidInputSizeTooltipSmall() throws EvaluationException {
1330
        Operators.OBJECT_ITEMSTACK_TOOLTIP.evaluate(new IVariable[]{});
×
1331
    }
×
1332

1333
    @IntegrationTest(expected = EvaluationException.class)
1334
    public void testInvalidInputTypeTooltip() throws EvaluationException {
1335
        Operators.OBJECT_ITEMSTACK_TOOLTIP.evaluate(new IVariable[]{DUMMY_VARIABLE});
×
1336
    }
×
1337

1338
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc